UIViewController在调removeFromParentViewController时遇到的问题
来源:互联网 发布:mac卸载java 8 编辑:程序博客网 时间:2024/06/05 15:27
参考地址:http://stackoverflow.com/questions/8379759/how-does-view-controller-containment-work-in-ios-5
在用UIViewController时,遇到点问题
原写法:
UserInformController* informController = [[UserInformController alloc] init];
[self.view addSubview:informController.view];
[self addChildViewController:informController];
移除时
[self.view removeFromSuperview];
[self removeFromParentViewController];
出错;
google到原因:
1.从无父Controller到添加到父Controller中
[vc willMoveToParentViewController:self];
[self addChildViewController:vc];
[self.view addSubview:vc.view]; // or something like this.
[vc didMoveToParentViewController:self];
2.从父Controller到移除
[vc willMoveToParentViewController:nil];
[vc.view removeFromSuperview];
[vc removeFromParentViewController];
发现问题,还另有原因,如果在子Controller中,把自己从父Controller中移除,在ios6中没问题,在iOS7中,会崩溃
[self willMoveToParentViewController:nil];
[self.view removeFromSuperview];
[self removeFromParentViewController]; //ios7中崩溃
暂时的解决方法,在子Controller中发通知,通知父Controller,移除子Controller
- UIViewController在调removeFromParentViewController时遇到的问题
- removeFromParentViewController
- UIViewController的初始化问题
- 解决含有 TabbarVC的 UIViewController 在 NavigationViewController显示时变换的问题
- 在使用zlib时遇到的问题
- 在使用AWS时遇到的问题
- 在ATM2时遇到的问题
- 在发表博客时遇到的问题
- 在开发javaweb时遇到的问题
- 在配置UEditor时遇到的问题
- uiviewcontroller的modal半透明问题.
- UINavigationController 弹出新的UIViewController时,setNavigationBarHidden失效的问题
- UINavigationController 弹出新的UIViewController时,setNavigationBarHidden失效的问题
- UITableView添加到UIViewController的view时显示问题
- 在封装框架时遇到的一些action的问题
- 关于在UIViewController中何时调用[super ... any method name]的问题
- VS2005水晶报表在时部署时遇到的问题
- VS2005水晶报表在时部署时遇到的问题
- 读技术书籍的困扰和一种解决办法尝试
- cocos2d-x中的动画的使用
- 表单上传文件提交实现ajax方式
- 用homebrew安装mongodb
- win7无线网络共享
- UIViewController在调removeFromParentViewController时遇到的问题
- C# DateTime 日期加1天 减一天 加一月 减一月
- SYSTEMTIME FileTimeToLocalFileTime 使用
- EPM7000/3000的几个全局输入脚GCLK1,OE2(GCLK2),OE1,GLCRn都是干什么的?怎么在编程中使用?
- ibatis #和$的区别
- Java中数组是如何存储的?
- 一些 android 图文混排的资料
- jQuery Mobile样式加载问题
- Android运行时异常“Binary XML file line # : Error inflating class”