-
-
Save Clafou/6728543 to your computer and use it in GitHub Desktop.
Edited the original Gist to remove the call to presentModalViewController:animated:, which simplifies it and removes its parameter.
This method has the sole aim of finding the adequate UIViewController. It's up to this method's caller to send presentModalViewController: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
| - (UIViewController *)modalPresenter | |
| { | |
| if ([self isKindOfClass:[UINavigationController class]]) { | |
| return [((UINavigationController *)self).topViewController modalPresenter]; | |
| } else if (self.presentedViewController) { | |
| return [self.presentedViewController modalPresenter]; | |
| } else { | |
| return self; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment