iOS 多级页面,返回到当前层级前2级页面

2018-05-22  本文已影响0人  键盘上的演绎者
NSInteger index = (NSInteger)[[self.navigationController viewControllers] indexOfObject:self];
if (index > 2) {
       [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:(index-2)] animated:YES];
}else{
       [self.navigationController popToRootViewControllerAnimated:YES];
}
上一篇下一篇

猜你喜欢

热点阅读