Skip to content

Instantly share code, notes, and snippets.

@imownbey
Created January 9, 2015 16:39
Show Gist options
  • Save imownbey/61bc55d9fc19a925100f to your computer and use it in GitHub Desktop.
Save imownbey/61bc55d9fc19a925100f to your computer and use it in GitHub Desktop.
@implementation UIViewController (Helpers)
- (UIViewController *)unwrapIfNav
{
if (![self isKindOfClass:[UINavigationController class]]) {
return self;
}
for (UIViewController *ctrl in self.childViewControllers) {
if (![ctrl isKindOfClass:[UINavigationController class]]) {
return ctrl;
}
}
return nil;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment