Created
September 20, 2012 05:26
-
-
Save i03nomura1y/3754104 to your computer and use it in GitHub Desktop.
using UIViewController.view as modal view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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