Skip to content

Instantly share code, notes, and snippets.

@i03nomura1y
Created September 20, 2012 05:26
Show Gist options
  • Save i03nomura1y/3754104 to your computer and use it in GitHub Desktop.
Save i03nomura1y/3754104 to your computer and use it in GitHub Desktop.
using UIViewController.view as modal view
@implementation MyUIViewController
- (void)showOnView:(UIView*)parent_{
if( !self.view.superview ) [self retain];
self.view.alpha = 0.0;
[parent_ addSubview:self.view];
[UIView animateWithDuration:1.0
animations:^(){
self.view.alpha = 1.0;
}
completion:^(BOOL finished){
//
}];
}
- (void)hide{
[UIView animateWithDuration:1.0
animations:^(){
self.view.alpha = 0;
}
completion:^(BOOL finished){
if(delegate) [delegate myViewClosed:self];
if( self.view.superview ) [self release];
[self.view removeFromSuperview];
}];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment