根据当前ViewController是push还是present方式显示的返回不同的back方式达到actionBack方法全统一
- (void)actionBack
{
//方式一
if (self.presentingViewController) {
[self dismissViewControllerAnimated:YES completion:nil];
} else {
[self.navigationController popViewControllerAnimated:YES];
}
/*
//方式二
if (self.navigationController.topViewController == self) {
[self.navigationController popViewControllerAnimated:YES];
} else {
[self dismissViewControllerAnimated:YES completion:nil];
}
*/
}
网友评论