Skip to content

Instantly share code, notes, and snippets.

@zhangkn
Created April 25, 2018 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangkn/1f3081414ab29b6a6a94962f47db5b62 to your computer and use it in GitHub Desktop.
Save zhangkn/1f3081414ab29b6a6a94962f47db5b62 to your computer and use it in GitHub Desktop.
iOS判断当前ViewController是push还是present方式显示的
- (void)exit{
// NSLog(@"presentingViewController :%@",self.presentingViewController);
//iOS判断当前ViewController是push还是present方式显示的
if (self.presentingViewController) {
[self dismissViewControllerAnimated:YES completion:nil];
} else {
if ([self.navigationController respondsToSelector:@selector(popViewControllerAnimated:)]) {
UINavigationController *savedUinvc = self.navigationController;
UIViewController *one = nil;
one = [savedUinvc popViewControllerAnimated:NO];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment