Skip to content

Instantly share code, notes, and snippets.

View Clafou's full-sized avatar

Seb Molines Clafou

View GitHub Profile
@Clafou
Clafou / gist:6728543
Last active December 24, 2015 02:09 — forked from MartinMoizard/gist:6537467
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:
- (UIViewController *)modalPresenter
{
if ([self isKindOfClass:[UINavigationController class]]) {
return [((UINavigationController *)self).topViewController modalPresenter];
} else if (self.presentedViewController) {
return [self.presentedViewController modalPresenter];
} else {
return self;
}
}