为什么在viewDidLoad中调用presentingViewController返回nil?
2015-01-19 21:57
288 查看
ios7应用开发入门经典(第7版)p256页提到,对于modal类型的segue,可以通过presentingViewController和presentedViewController获取segue前后的controller。
但在ios8中实践发现presentingViewController返回了nil. 这是什么情况?查阅stackoverflow,得到如下答案:
When
called, there is no guarantee that the view controller hierarchy is loaded in the navigation tree. Moving the logic to a later stage (for example:
should resolve that issue as
be loaded by then.
http://stackoverflow.com/questions/26081661/presentingviewcontroller-is-nil-when-using-presentviewcontrolleranimatedcomple
但在ios8中实践发现presentingViewController返回了nil. 这是什么情况?查阅stackoverflow,得到如下答案:
When
viewDidLoadis
called, there is no guarantee that the view controller hierarchy is loaded in the navigation tree. Moving the logic to a later stage (for example:
viewWillAppear)
should resolve that issue as
presentingControllershould
be loaded by then.
http://stackoverflow.com/questions/26081661/presentingviewcontroller-is-nil-when-using-presentviewcontrolleranimatedcomple
相关文章推荐
- ViewController里已连接的IBOutlet为什么会是nil
- 调用底层的viewController--返回底层
- viewdidload的调用和viewcontroller的生命周期
- 调用底层的viewController--返回底层
- three20 为什么self.navigationController.view 是nil
- 不用UIImageViewController 调用系统摄像头
- ViewGroup为什么不会调用onDraw
- UINavigationController下的viewcontroller不调用viewwillappear
- iphone 调用两次popViewControllerAnimated
- ViewGroup为什么不会调用onDraw
- IOS UISplitViewController之 解决 密码框添加之后 调用子视图的转向方法之时 对象为空
- 使用MBProgressHUD引发"self.navigationController.view为nil"的血案
- 为什么调用支付宝接口后返回是错误页面!
- ViewGroup为什么不会调用onDraw
- pushViewController后获得返回事件
- 为什么CreateThread()调用创建线程时,系统设置线程内核对象的引用计数为1,在Create函数返回前是2
- MVC3.0 不同view层,调用相同Controller方法,但参数不同
- 因IOS版本导致的模态视图控制器dismissModalViewControllerAnimated调用问题
- 有关viewController中viewDidLoad方法执行多次的问题
- 关于viewDidLoad里调用presentModalViewController的问题