Created
April 25, 2018 11:28
-
-
Save zhangkn/1f3081414ab29b6a6a94962f47db5b62 to your computer and use it in GitHub Desktop.
iOS判断当前ViewController是push还是present方式显示的
This file contains 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
- (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