您的位置:首页 > 其它

为什么在viewDidLoad中调用presentingViewController返回nil?

2015-01-19 21:57 288 查看
ios7应用开发入门经典(第7版)p256页提到,对于modal类型的segue,可以通过presentingViewController和presentedViewController获取segue前后的controller。

但在ios8中实践发现presentingViewController返回了nil. 这是什么情况?查阅stackoverflow,得到如下答案:

When
viewDidLoad
is
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
presentingController
should
be loaded by then.
http://stackoverflow.com/questions/26081661/presentingviewcontroller-is-nil-when-using-presentviewcontrolleranimatedcomple
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: