whose view is not in the window hierarchy
来源:互联网 发布:nginx下载windows 编辑:程序博客网 时间:2024/05/21 04:41
问题描述:有A、B两个view controller,在A的viewDidLoad方法中,调用presentViewController去present B View Controller,出现”whose view is not in the window hierarchy” warning,且没有正确跳转。
问题解释:
stack overflow 回答原文如下:
Where are you calling this method from? I had an issue where I was attempting to present a modal view controller within the
viewDidLoad
method. The solution for me was to move this call to the viewDidAppear:
method.My presumption is that the view controller's view is not in the window's view hierarchy at the point that it has been loaded (when the
viewDidLoad
message is sent), but it is in the window hierarchy after it has been presented (when the viewDidAppear:
message is sent).Caution
If you do make a call to
presentViewController:animated:completion:
in the viewDidAppear:
you may run into an issue whereby the modal view controller is always being presented whenever the view controller's view appears (which makes sense!) and so the modal view controller being presented will never go away...Maybe this isn't the best place to present the modal view controller, or perhaps some additional state needs to be kept which allows the presenting view controller to decide whether or not it should present the modal view controller immediately.
stack overflow 链接:http://stackoverflow.com/questions/11862883/whose-view-is-not-in-the-window-hierarchy
解决方案:不要在A的viewDidLoad方法中,调用presentViewController来present B View Controller,而是在viewDidAppear中。理由是:viewDidLoad调用时,此时view controller’s view 并不在window 的view hierarchy中。
遗留问题:也许viewDidAppear中并不是最合适的转场地方。
0 0
- whose view is not in the window hierarchy!
- whose view is not in the window hierarchy!
- whose view is not in the window hierarchy
- whose view is not in the window hierarchy
- whose view is not in the window hierarchy
- whose view is not in the window hierarchy
- whose view is not in the window hierarchy!
- whose view is not in the window hierarchy!
- window模态导航控制器出现的问题 "whose view is not in the window hierarchy!"
- 对Warning: Attempt to present on whose view is not in the window hierarchy!的解决方案
- Warning: Attempt to present A on B whose view is not in the window hierarchy!
- 对Warning: Attempt to present on whose view is not in the window hierarchy!的解决方案
- 对Warning: Attempt to present on whose view is not in the window hierarchy!的解决方案
- Warning: Attempt to present * on * whose view is not in the window hierarchy!
- Warning: Attempt to present xx on yy whose view is not in the window hierarchy!
- Warning: Attempt to present A on B whose view is not in the window hierarchy!
- Attempt to present on whose view is not in the window hierarchy!
- ios开发异常:whose view is not in the window hierarchy! (20
- 【SSH系列】spring中为什么要使用IOC
- C++中括号()操作符的重载举例及解析
- Robot FrameWork学习网址
- poj 2373 dp单调队列优化
- Java 多线程同步机制
- whose view is not in the window hierarchy
- 杂记一
- Inorder Successor in BST
- 高仿- 萌聚 app。
- 谈Android模拟点击的价值和实现
- 格雷码(Gray Code)的生成
- java 集合之ArrayList集合元素重复删除
- hdu 1863 畅通工程 (最小生成树)
- 欢迎使用CSDN-markdown编辑器