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

2018-07-10  本文已影响6人  姚姚先生
            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];
            }
上一篇 下一篇

猜你喜欢

热点阅读