whose view is not in the window hierarchy! 解决办法

self.view.addSubview(alert.view)
            self.addChildViewController(alert)
时间: 2024-08-09 22:50:57

whose view is not in the window hierarchy! 解决办法的相关文章

Swift - whose view is not in the window hierarchy 问题解决方法

问题现象:想在页面初始化的时候,使用self.presentViewController方法弹出个告警提示框UIAlertController.但行后报了个如下告警,同时告警框也出不来. 1 2015-03-10 09:55:34.197 Test[1140:29622] Warning: Attempt to present <UIAlertController: 0x7c95ca20> on <Test.ViewController: 0x7a6afc60> whose vie

Warning: Attempt to present on whose view is not in the window hierarchy!

当我想从一个VC跳转到另一个VC的时候,一般会用 - (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion;当然也可以用导航push. 有时会遇到了此类警告:Warning: Attempt to present on whose view is not in the window hier

IOS 开发中 Whose view is not in the window hierarchy 错误的解决办法

在 IOS 开发当中经常碰到 whose view is not in the window hierarchy 的错误,该错误简单的说,是由于 "ViewController" 还没有被夹在,就调用该 ViewController 或者 ViewController 内的方法时,就会报这个错误. 在不同地方调用 ViewController,解决的方法也不太一样. 1. 在 一个 ViewController 里面调用另外一个 ViewController 是出现这个错误: 该错误一

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)?

Attempt to present on whose view is not in the window hierarchy!

在开发的时候,有时候会遇到 1.ios attempt to present whose view is not in the window hierarchy 2.Warning: Attempt to present on whose view is not in the window hierarchy! 等等这样类似的提示,只要里面提示有 window hierarchy,都是view hierarchy的理解不到位导致的. 上面的问题都是在一个controller的view还没加到wi

MyEclipse Servers视窗出现“Could not create the view: An unexpected exception was thrown”错误解决办法

MyEclipse 打开后有时候莫名的在server窗口里抛出“Could not create the view: An unexpected exception was thrown”错误,解决办法: 打开myeclipse所在的wordspace文件夹,在下面子文件夹 .metadata\.plugins\org.eclipse.core.runtime\.settings 删除 com.genuitec.eclipse.ast.deploy.core.prefs 重启myeclipse即

对Warning: Attempt to present XXX on XXX whose view is not in the window hierarchy!的解决方案

下面是我找到的最靠谱的答案了.尝试后问题果然解决了.分享给大家.http://blog.csdn.net/sbvfhp/article/details/19826221 当我想从一个VC跳转到另一个VC的时候, 一般会用- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion;当然也可以用导

Warning: Attempt to present A on B whose view is not in the window hierarchy!

UIViewController 显示的主页面 添加了一个scrollView UICollectionViewController 自带collectionView UITableViewController A自带 tableView UITableViewController  B 被present的界面 把collectionView,tableView 添加到scrollView上以显示滑动效果 问题,从UICollectionViewController 的cell选中present

Warning: Attempt to present &lt;UIAlertController: 0x7fb6ab704950&gt; on &lt;UIViewController: 0x7fb6ab51c810&gt; whose view is not in the window hierarchy!

对于在UIView上,是不能跳转的,所以我们通常要借助UIViewController,但经常会出现UIViewController没被加载的情况.这时就会报这个错. 解决方法: viewCon = (UIApplication.shared.keyWindow?.rootViewController)!  self.viewCon.present(alertView, animated: true, completion: nil); 希望后面的童鞋不要掉坑里了哦!!!!