判断当前viewcontroller是push还是present

2018-02-23  本文已影响67人  二先生Developer
NSArray *viewcontrollers = self.navigationController.viewControllers;
if (viewcontrollers.count > 1) {
    if ([viewcontrollers objectAtIndex:viewcontrollers.count - 1] == self) { //push方式
        [self.navigationController popViewControllerAnimated:YES];
    }
}
else { //present方式
    [self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
上一篇下一篇

猜你喜欢

热点阅读