whose view is not in the window hierarchy
参考:http://www.jianshu.com/p/9e90cb866fdf
在做界面跳转的时候,我们经常会用到这两个函数
func dismissViewControllerAnimated(flag:Bool, completion: (() ->Void)?)
func presentViewController(viewControllerToPresent:UIViewController, animated flag:Bool, completion: (() ->Void)?)
有时候先把自己所在的这个页面 dismiss 掉,再 present 另外一个页面时,控制台会提示 whose view is not in the window hierarchy 这个错误信息。
解决方法:
①如果这两个语句出现按钮点击事件里面
这时只要把 dismiss 这一句注释掉,直接 present 就可以啦。
②而如果这种语句出现在 ViewDidLoad 方法中
那么则应该把语句转移到 ViewDidAppear 方法中,毕竟你不能对一个只 Load 完毕,却还没有 Appear 出来的 ViewController 要求太多 :)
原文链接:http://www.jianshu.com/p/9e90cb866fdf
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。
whose view is not in the window hierarchy的更多相关文章
- IOS 开发中 Whose view is not in the window hierarchy 错误的解决办法
在 IOS 开发当中经常碰到 whose view is not in the window hierarchy 的错误,该错误简单的说,是由于 "ViewController" ...
- Warning: Attempt to present on whose view is not in the window hierarchy!
当我想从一个VC跳转到另一个VC的时候,一般会用 - (void)presentViewController:(UIViewController *)viewControllerToPresent a ...
- Swift - whose view is not in the window hierarchy 问题解决方法
问题现象:想在页面初始化的时候,使用self.presentViewController方法弹出个告警提示框UIAlertController.但行后报了个如下告警,同时告警框也出不来. 1 2015 ...
- 错误:Warning: Attempt to present <UIAlertController: 0x7fd192806e20> on <ViewController: 0x7fd1928048d0> whose view is not in the window hierarchy!
系统:mac OS 10.12 (16A323) Xcod:8.3.3 错误:Warning: Attempt to present <UIAlertController: 0x7fd1928 ...
- iOS开发出错whose view is not in the window hierarchy!的解决
大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请多提意见,如果觉得不错请多多支持点赞.谢谢! hopy ;) 一个简单的单窗口App在运行时出现错误: 2016-04-07 ...
- Attempt to present <TestViewController2: 0x7fd7f8d10f30> on <ViewController: 0x7fd7f8c054c0> whose view is not in the window hierarchy!
当 storyboard里面的 按钮 即连接了 类文件里面的点击方法 又 连接了 storyboard里 另一个 控制器的 modal 就会出现类似Attempt to present & ...
- Warning: Attempt to present A on B whose view is not in the window hierarchy!
昨天写豆瓣发广播Demo的时候,为了写Demo的简单,就使用了Storyboard,结果执行视图跳转时遇到了这个问题: Warning: Attempt to present <UINaviga ...
- swift一次 Attempt to present on whose view is not in the window hierarchy的解决方法
做的是二维码扫描,扫描后识别为URL的话就跳转到webview 加载网页,用的是代理传值的方式.扫描到了 值传递到主页 扫描窗体退出,检测值是否是http://开头 是网页就跳转. 问题出在传值到主界 ...
- iOS whose view is not in the window hierarchy!
解决方法: viewController只Load完毕,没有Appear,此时应该将语句转移到ViewDidAppear方法中
随机推荐
- sql语句 in的教训
如果子查询条件数据量特别大的话,千万不要用子查询.
- no result defined for action
1.no result defined for action .......and result input 或者 no result defined for action .......and ...
- Android 在非Activity的类中调用startActivityForResult
http://www.360doc.com/content/11/0720/10/7322578_134657348.shtml
- Spring MVC 处理静态资源不能访问问题
在web.xml文件中加入如下代码: <servlet-mapping> <servlet-name>default</servlet-name> <url- ...
- 使用 antd Table组件, 异步获取数据
使用React.js + Redux + antd 制作CMS 后台内容管理系统,分享一点点积累,欢迎讨论. 在this.state中初始化数据: this.state = { pageNum:1, ...
- Redis JedisPool
获取连接池,通常连接池为单例,这里使用 双端检测机制保证只有一个实例 public class JedisPoolUtil { private static volatile JedisPool je ...
- 标准C++之运算符重载和虚表指针
1 -> *运算符重载 //autoptr.cpp #include<iostream> #include<string> using namespace std ...
- 对于angularJS的一点思考
已经找好工作近两周了,入职基本上还算顺利,自己两年来的挑灯夜战也算是有了收获,于是这两周基本上是按部就班的工作,没有学习什么新技术.在上个公司的时候,同事在项目中使用angularJs,之前他也没有接 ...
- PHP -- Perl风格正则表达式
1.正则表达式作为一个匹配的模版,是由原子(普通字符,例如a-z),有特殊功能的字符(元字符,例如*.+ 和?等),以及模式修正符三个部分组成.2.在于Perl兼容的正则表达式函数中使用模式时一定要给 ...
- Java的发展历程
Java的发展历程充满了传奇色彩. 最初,Java是由Sun公司的一个研究小组开发出来的, 该小组起先的目标是想用软件实现对家用电器进行集成控制的小型控制装置. 开始,准备采用C++,但C++太复杂, ...