Created by Jamz Tang at 1 September 2011
Typically you like to do something like below when you wanted to remove a view from its parent view.
[myView removeFromSuperview];
Sometimes it's not that please for a user to see an UI component disappearing suddenly. You'd then consider adding some transition effects, and here's a little code snippet in the UIView+JTRemoveAnimated category for how you can get a fade out effect on view removal.
So from now on, you just needed to do this to fade out any UIViews
[myView removeFromSuperviewAnimated]
Clone this repository:
git clone git://gist.github.com/1259860.git UIView+JTRemoveAnimated
If you think this is useful, share this article with your friends :)
blog comments powered by DisqusUINibDecoderProxy Observes what's encoded in an NSCoder object
JTKeyValueObserver Revisiting KVO+Block, the simplest version.
MethodSwizzle Method Swizzling in Objective-C
UITableViewDeleteActionResponder Quick hack to enable delete menu item in UITableView menuController
UIApplicationAddition Quickly switch supported UIInterfaceOrientation for your View Controllers
JTTargetActionBlock Adding Block support for UIControl's Target-Action mechanism
NSArray-JTArraySplit Splitting an array to several components
UIImage+JTImageDecode Force decompressing UIImage in background to achieve better performance
UINavigationBar-JTDropShadow Adding drop shadow on UINavigationBar (before iOS 6)
UIImage-JTImageCrop Crop an image in specific rect
UIView+JTRemoveAnimated Adding fadeout effect to any -[UIViews removeFromSuperview]
JTStringAddition NSStringf. Simpler printf styled +[NSString stringWithFormat:]
UIView-JTViewToImage Rendering any UIViews into UIImage in one line (updated with iOS 7 support)
NSObject-JTNibLoader Loading a Nib file programmatically using NSObject category
UIImage-JTColor Creating a placeholder UIImage dynamically with color
NSObject-JTCancelableScheduledBlock Cancelable Scheduled Blocks in Objective-C