原因:

是某个viewController的生命周期控制出现了错误,所以尽量避免一个controller的view去addsubview另一个controller的view,这样会破坏层级关系,导致第一controller不能控制另一个controller的生命周期。

解决办法:

在presentViewController,需要添加 [mainVC addChildViewController:VC];

//先添加到主控制器

[self addChildViewController:vc];

//再先添加到主控制器的视图里面

[self.view addSubview:vc.view];

或者修改:

[self.parentViewController presentViewController:viewController animated:YES completion:nil]; 或

[self.view.window.rootViewController pushViewController:YOUR_VIEW_CONTROLER animated:YES];

xocde8打印出:Presenting view controllers on detached view controllers is discouraged的更多相关文章

  1. Presenting view controllers on detached view controllers is discouraged <CallViewController: 0x14676e240>.

    今天在优化app时,发现程序出现这种警告:“ Presenting view controllers on detached view controllers is discouraged <C ...

  2. Presenting view controllers on detached view controllers is discouraged

    本文转载至 http://www.xuebuyuan.com/2117943.html Presenting view controllers on detached view controllers ...

  3. iOS错误之-Presenting view controllers on detached view controllers is discouraged

    遇到这个警告后找了一下网络资源,基本上只说通过 [self.view.window.rootViewController presentViewController:controller animat ...

  4. iOS Programming Autorotation, Popover Controllers, and Modal View Controllers

    iOS Programming Autorotation, Popover Controllers, and Modal View Controllers  自动旋转,Popover 控制器,Moda ...

  5. 创建控制器的方法、控制器加载view过程、控制器view的生命周期、多控制器组合

    在介绍四大对象的那篇博客中,可以基本了解到程序启动的过程: main-->UIApplicationMain-->创建UIApplication的实例和app代理AppDelegate的实 ...

  6. 获取View的截图-将View转换为Bitmap对象

    开发中,有时候需要获取View的截图来做动画来达到动画流程的目的 原理:将View的内容画到一个Bitmap画布上,然后取出 下面封装了一个从View生成Bitmap的工具类 /** * 将View转 ...

  7. The method onClick(View) of type new View.OnClickListener(){} must override a superclass

    最近在做一个jWebSocket Android客户端的Demo时遇到如下错误: ok —————— 最近在做一个jWebSocket Android客户端的Demo时遇到如下错误: ".. ...

  8. (转)Qt Model/View 学习笔记 (五)——View 类

    Qt Model/View 学习笔记 (五) View 类 概念 在model/view架构中,view从model中获得数据项然后显示给用户.数据显示的方式不必与model提供的表示方式相同,可以与 ...

  9. onClick(View) of type new View.OnClickListener(){} must override a superclass method

    原地址:http://blog.csdn.net/aeolus1019/article/details/8014798 Android开发过程中代码错误报错如下: - implements andro ...

随机推荐

  1. Hibernate搭建框架(一)

    什么是hibernate? hibernate是一个orm框架,实现了对JDBC的封装.通过xml文件来实现类和表之间的映射,这样就可以使用操作对象的方式来操作数据库. 官网:http://hiber ...

  2. JavaScript 原型和引用趣点

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head ...

  3. Multipart/form-data POST文件上传

    简单的HTTP POST 大家通过HTTP向服务器发送POST请求提交数据,都是通过form表单提交的,代码如下: <form method="post"action=&qu ...

  4. Spring 错误日志

    13:19:14.437 [main] DEBUG org.springframework.boot.context.logging.ClasspathLoggingApplicationListen ...

  5. PL/SQL之高级篇

    原文地址:http://www.cnblogs.com/sin90lzc/archive/2012/08/30/2661117.html 参考文献:<Oracle完全学习手册> 1.概述 ...

  6. 【Oracle】to_char技巧

    Select to_char(sysdate,'ss') from dual;      取当前时间秒部分 Select to_char(sysdate,'mi') from dual;      取 ...

  7. 转:Python结合P有winauto进行windows UI自动化

    https://blog.csdn.net/z_johnny/article/details/52778064

  8. SLAM:ORB-SLAM 位姿优化描述

    只知道算法描述和代码,而不知道原理是比较扯的事情,还是把原理转载一下. 原文链接: http://www.cnblogs.com/luyb/p/5447497.html ORB-SLAM作为单目SLA ...

  9. PythonOpenCV:MLP用于最近邻搜索

    一:简单C++版本的链接: http://blog.csdn.net/kaka20080622/article/details/9039749 OpenCV的ml模块实现了人工神经网络(Artific ...

  10. 使用Reporting Services时遇到的小问题

    同事忙不开了交过来的一个小问题,以前我也没有做过Reporting Services相关的. 大概看了一下,是数据集那边的查询代码接收不到报表参数,而且不是单纯地接收不到,具体情况如下.. 命令类型是 ...