码迷,mamicode.com
首页 > 其他好文 > 详细

关于Presenting view controllers on detached view ...

时间:2015-08-27 11:29:11      阅读:446      评论:0      收藏:0      [点我收藏+]

标签:

使用模态跳转,Xcode有时候会出现

Presenting view controllers on detached view controllers is discouraged <SetViewController: 0x7fedb94f0f60>.

这样的警告代码,如果你认为你的层次之间没有问题(其实就是层次问题。present出来的模态窗口,禁止再使用present 来弹出其它的子窗口)

解决方法:

WithUsViewController *with=[[WithUsViewController alloc]init];
[self presentViewController:with animated:YES completion:nil];

改为:

  AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
  WithUsViewController *with=[[WithUsViewController alloc]init];
  [delegate.window.rootViewController presentViewController:with animated:YES completion:^{    
    }];

即可

关于Presenting view controllers on detached view ...

标签:

原文地址:http://my.oschina.net/rainwz/blog/497697

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!