iOS判断当前ViewController是push还是present方式显示的
展开全部
if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]) {
//判断1
[self dismissViewControllerAnimated:YES completion:nil];
} else if ([self.navigationController respondsToSelector:@selector(popViewControllerAnimated:)]) {
//判断2
[self.navigationController popViewControllerAnimated:YES];
//判断1
[self dismissViewControllerAnimated:YES completion:nil];
} else if ([self.navigationController respondsToSelector:@selector(popViewControllerAnimated:)]) {
//判断2
[self.navigationController popViewControllerAnimated:YES];
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询