关于Presenting view controllers on detached view ...

使用模态跳转,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:^{    
    }];

即可

时间: 2024-08-28 10:29:29

关于Presenting view controllers on detached view ...的相关文章

Presenting view controllers on detached view controllers is discouraged &lt;CallViewController: 0x14676e240&gt;.

今天在优化app时,发现程序出现这种警告:“ Presenting view controllers on detached view controllers is discouraged <CallViewController: 0x14676e240>. ” 首先说明一下,我是在判断无网络时,要弹出一个提示框时出现的这个问题 在网上查资料时,又说是当前控制器已present一个视图,再present一个视图时,就会出现这个错误.但是在我的项目中当前页面根本就没有第二个present了,因此

Presenting view controllers on detached view controllers is discouraged

出现这个警告的原因是presentViewController的receiver是一个detached view controller.比方说:window有一个root view controller,然后我们把某个view controller(VC1)的view添加到了root view controller的subview上面,然后在VC1上面presentViewController.这时我们需要将VC1添加到root view controller的childController里面

ios: push viewcontroller 时出现Presenting view controllers on detached view controllers is discouraged 警告

原因:a,b,c 三个viewcontroller,a作为根视图,b.view 添加到a上,在b中模态(presentViewController)弹出c. 这种情况就会出现标题的警告 解决方法: 1. [self.view.window.rootViewControllerpresentViewController:controlleranimated:YEScompletion:nil]; /*这里一段解释 The reason of this warning is i was presen

ios Presenting view controllers on detached view controllers is discouraged &lt;BasicInfoVC: 0x7fb2dc24

出现的原因: 在控制器A中添加控制器B--[A.view addSubView: B.view] 在控制器B中弹出新的控制器时报此waring 解决: [A addChildViewController:B]; [B.parentViewController presentViewController:alertController animated:YES completion:nil]; 详见:http://stackoverflow.com/questions/19890761/warni

【IOS笔记】Creating Custom Content View Controllers

Creating Custom Content View Controllers 自定义内容视图控制器 Custom content view controllers are the heart of your app. You use them to present your app’s unique content. All apps need at least one custom content view controller. Complex apps divide the workl

【IOS笔记】Resource Management in View Controllers

Resource Management in View Controllers 视图控制器的资源管理 View controllers are an essential part of managing your app’s resources. View controllers allow you to break your app up into multiple parts and instantiate only the parts that are needed. But more t

【IOS笔记】Using View Controllers in Your App

参考:http://www.cnblogs.com/patientAndPersist/p/3279645.html Using View Controllers in Your App Whether you are working with view controllers provided by iOS, or with custom controllers you’ve created to show your app’s content, you use a similar set o

Page View Controllers

You use a page view controller to present content in a page-by-page manner. A page view controller manages a self-contained view hierarchy. The parent view of this hierarchy is managed by the page view controller, and the child views are managed by t

更轻量的 View Controllers

View controllers 通常是 iOS 项目中最大的文件,因为它们包含了许多不必要的代码.所以 View controllers 中的代码几乎总是复用率最低的.我们将会看到给 view controllers 瘦身的技术,让代码变得可以复用,以及把代码移动到更合适的地方. http://tang3w.com/translate/objective-c/objc.io/2013/10/22/%E6%9B%B4%E8%BD%BB%E9%87%8F%E7%9A%84-view-control