ios ipad 不调用 viewVillAppera 的解决办法
2011-07-22 21:31
423 查看
If the view belonging to a view controller is added to a view hierarchy directly, the view controller will not receive this message. If you insert or add a view to the view hierarchy, and it has a view controller, you should send the associated view controller this message directly. Failing to send the view controller this message will prevent any associated animation from being displayed.
文档说的挺清楚的:
如果包含在一个viewController中的view被直接添加到一个view上,就像这样:
[view1 addSubView: viewController.view];,这样我们的viewController就不会收到viewDidAppear:的消息。按这种方式添加视图的话,我们一般需要手动发送这个消息,也就是调用viewController的viewDidAppear方法。否则的话相关的动画都无法正常显示。
像navigationController的push,或者是presentModelViewController的方法不属于上述方式。而且有明显的动画显示(弹出效果),个人认为是自动调用viewDidAppear方法的。
Example
[self.view addSubview:m_currentViewController.view]; [self navigationAddController:controller];[controller viewWillAppear:YES];
文档说的挺清楚的:
如果包含在一个viewController中的view被直接添加到一个view上,就像这样:
[view1 addSubView: viewController.view];,这样我们的viewController就不会收到viewDidAppear:的消息。按这种方式添加视图的话,我们一般需要手动发送这个消息,也就是调用viewController的viewDidAppear方法。否则的话相关的动画都无法正常显示。
像navigationController的push,或者是presentModelViewController的方法不属于上述方式。而且有明显的动画显示(弹出效果),个人认为是自动调用viewDidAppear方法的。
Example
[self.view addSubview:m_currentViewController.view]; [self navigationAddController:controller];[controller viewWillAppear:YES];
相关文章推荐
- iOS模态跳转的页面WebView中加载html调用本机相册会dismiss返回上一个页面解决办法
- iOS CAlayer 动画进入后台或者 调用viewWillDisappear viewDidDisappear后动画暂停问题的解决办法
- ios 4.3 中 viewDidAppear没有被调用的解决办法
- ios 4.3 中 viewDidAppear没有被调用的解决办法
- WebView和加载html页面时无法调用alert的解决办法
- iOS 上架提示ipad需要显示四个方位,而我们只能竖屏的时候的解决办法
- iOS开发:MKMapView地图内存持续增加的释放解决办法
- 『IOS』UIScrollView无法响应touch事件的解决办法
- Xcode8 ios 10 调用相机、相册、麦克风、位置等隐私问题崩溃解决办法
- iPad/iPhone登陆iOS Beta页提示"Your session has expired"解决办法
- iOS 开发中 Whose view is not in the window hierarchy 错误的解决办法
- iOS开发- iOS7显示偏差(UITableView下移)解决办法
- iOS 调用相册或摄像头后状态栏消失解决办法
- ipad项目下 更改tableview 的背景为透明不起作用----------解决办法
- iOS用SegmentController来切换tableView的时候 reloadData会造成数据重复创建 解决办法
- IOS-23-Xcode6.4里UITableView不显示的可能原因及解决办法
- IOS 下获取 rootviewcontroller 的版本不同的问题解决办法
- iOS(iPhone/iPad) 屏幕旋转响应函数的缺点与窗口大小位置调整,以及解决办法
- h5+中iOS调用plus.runtime.launchApplication不执行失败回调解决办法
- ios开发——长按按出两个UIAlertView的解决办法