iOS判断当前vc是push还是present的

- (void)back {
    if (self.presentingViewController && self.navigationController.viewControllers.count == 1) {
        [self dismissViewControllerAnimated:YES completion:nil];
    } else {
        [self.navigationController popViewControllerAnimated:YES];
    }
}

参考了该文章,修改了一个小bug

你可能感兴趣的:(iOS判断当前vc是push还是present的)