ios开发异常:whose view is not in the window hierarchy! (20

来源:互联网 发布:最便宜的域名虚拟机 编辑:程序博客网 时间:2024/05/22 18:00
问题描述:
在storyboard中,由controller A跳转到controllerB的时候然后报Warning: Attempt to present on whose view is not in thewindow hierarchy!

问题参考:
http://stackoverflow.com/questions/11862883/whose-view-is-not-in-the-window-hierarchy
问题分析:
My presumption is that the view controller'sview isnot inthe window hierarchy at the point that it has been loaded (whenthe viewDidLoad messageis sent), but it is inthe window hierarchy after it has been presented (whenthe viewDidAppear: messageis sent).

补上中文分析:
结合自己的思考以及半通不通的英文水平,大致分析一下,应该是这么回事情,在controllera的viewDidLoad里面直接跳转controllerb,然后导致在显示controller b的时候也调用了controllera来显示,然后发现这个window的层次结构就错乱了。

问题解决:
在controllera中跳转的时候,要在viewDidLoad以及viewDidAppear之后才能跳转,所以可以自己想办法延时跳转,而不是直接跳转,延时的话,方法就很多了,可以用nstimer各种等等。

0 0