内容简介:popToViewController用法方式一,不推荐方式二,推荐
popToViewController用法
方式一,不推荐
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:2] animated:YES];
方式二,推荐
for (UIViewController *controller in self.navigationController.viewControllers) {
if ([controller isKindOfClass:[你要跳转到的Controller class]]) {
[self.navigationControllerpopToViewController:controller animated:YES];
}
}
方式三,推荐 这种方式可以适合返回指定控制器并调用其方法(比如刷新)
// 返回调用的控制器
LLXXXcontroller *myControl = nil;
for (int i = 0; i < self.navigationController.viewControllers.count; i++) {
CustomViewController *cv = self.navigationController.viewControllers[i];
if ([cv isKindOfClass:[LLXXXcontroller class]]) {
myControl = (LLXXXcontroller *)cv;
break;
}
}
[self.navigationController popToViewController:myControl animated:YES];
[myControl refreshData];
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
The Smashing Book
Jacob Gube、Dmitry Fadeev、Chris Spooner、Darius A Monsef IV、Alessandro Cattaneo、Steven Snell、David Leggett、Andrew Maier、Kayla Knight、Yves Peters、René Schmidt、Smashing Magazine editorial team、Vitaly Friedman、Sven Lennartz / 2009 / $ 29.90 / € 23.90
The Smashing Book is a printed book about best practices in modern Web design. The book shares technical tips and best practices on coding, usability and optimization and explores how to create succes......一起来看看 《The Smashing Book》 这本书的介绍吧!