iOS开发判断当前ViewController是push还是present的方式显示的
if (self.navigationController.viewControllers.count > 1 && [self.navigationController.viewControllers lastObject] == self){
[self.navigationController popViewControllerAnimated:animated];
}else{
[self dismissViewControllerAnimated:animated completion:nil];
}