Created
August 22, 2011 11:02
-
-
Save aquarius/1162145 to your computer and use it in GitHub Desktop.
Hide and present new modal view animated
This file contains hidden or 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 UIViewController (Convenience) | |
- (void)mn_hideCurrentModalControllerAndPresentController:(UIViewController *)controller | |
{ | |
if (self.modalViewController) { | |
[self dismissModalViewControllerAnimated:YES]; | |
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC); | |
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | |
[self presentModalViewController:controller animated:YES]; | |
}); | |
} else { | |
[self presentModalViewController:controller animated:YES]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment