【iOS】判断viewcontroller 来源(展示出来)的4个方法
来源:互联网 发布:淘宝怎么换购产品 编辑:程序博客网 时间:2024/06/13 07:02
isMovingFromParentViewController / isMovingToParentViewController :适应于container 和 content viewcontroller 之间。例如:addChildViewController方法,navigationController 中的push 和pop。
isBeingPresented / isBeingDismissed :适应于present 和 presented viewcontroller 之间。presentViewController: animated: completion方法。
【官方资料】
Determining Why a View’s Appearance Changed
Occasionally, it can be useful to know why a view is appearing or disappearing. For example, you might want to know whether a view appeared because it was just added to a container or whether it appeared because some other content that obscured it was removed. This particular example often appears when using navigation controllers; your content controller’s view may appear because the view controller was just pushed onto the navigation stack or it might appear because controllers previously above it were popped from the stack.
The UIViewController class provides methods your view controller can call to determine why the appearance change occurred. Table 5-1 describes the methods and their usage. These methods can be called from inside your implementation of the viewWillAppear:, viewDidAppear:, viewWillDisappear: and viewDidDisappear: methods.
Table 5-1 Methods to call to determine why a view’s appearance changed
isMovingFromParentViewController
You call this method inside your viewWillDisappear: and viewDidDisappear: methods to determine if the view controller’s view is being hidden because the view controller was removed from its container view controller.
isMovingToParentViewController
You call this method inside your viewWillAppear: and viewDidAppear: methods to determine if the view controller’s view is being shown because the view controller was just added to a container view controller.
isBeingPresented
You call this method inside your viewWillAppear: and viewDidAppear: methods to determine if the view controller’s view is being shown because the view controller was just presented by another view controller.
isBeingDismissed
You call this method inside your viewWillDisappear: and viewDidDisappear: methods to determine if the view controller’s view is being hidden because the view controller was just dismissed.
isBeingPresented / isBeingDismissed :适应于present 和 presented viewcontroller 之间。presentViewController: animated: completion方法。
【官方资料】
Determining Why a View’s Appearance Changed
Occasionally, it can be useful to know why a view is appearing or disappearing. For example, you might want to know whether a view appeared because it was just added to a container or whether it appeared because some other content that obscured it was removed. This particular example often appears when using navigation controllers; your content controller’s view may appear because the view controller was just pushed onto the navigation stack or it might appear because controllers previously above it were popped from the stack.
The UIViewController class provides methods your view controller can call to determine why the appearance change occurred. Table 5-1 describes the methods and their usage. These methods can be called from inside your implementation of the viewWillAppear:, viewDidAppear:, viewWillDisappear: and viewDidDisappear: methods.
Table 5-1 Methods to call to determine why a view’s appearance changed
isMovingFromParentViewController
You call this method inside your viewWillDisappear: and viewDidDisappear: methods to determine if the view controller’s view is being hidden because the view controller was removed from its container view controller.
isMovingToParentViewController
You call this method inside your viewWillAppear: and viewDidAppear: methods to determine if the view controller’s view is being shown because the view controller was just added to a container view controller.
isBeingPresented
You call this method inside your viewWillAppear: and viewDidAppear: methods to determine if the view controller’s view is being shown because the view controller was just presented by another view controller.
isBeingDismissed
You call this method inside your viewWillDisappear: and viewDidDisappear: methods to determine if the view controller’s view is being hidden because the view controller was just dismissed.
0 0
- 【iOS】判断viewcontroller 来源(展示出来)的4个方法
- iOS 一个ViewController上显示2个tableView的方法
- 如何在present出来的viewController里使用push方法
- PHP判断移动设备来源的方法
- PHP判断移动设备来源的方法
- ios--判断是否是ViewController类的实例
- ios开发 present 出来的viewcontroller 强制横竖屏切换代码分享 (代码不解释)
- ios--ViewController的生命周期
- ios ViewController的生命周期
- 关于多个ViewController之间进行数据传递的方法
- ios不同的viewcontroller之间数据传递方法
- IOS -- ViewController的LoadView和ViewDidLoad方法相关知识总结
- IOS中 ViewController中默认方法的执行顺序
- IOS -- ViewController的LoadView和ViewDidLoad方法相关知识总结
- 在ViewController之间传递数据的方法【iOS】
- IOS -- ViewController的LoadView和ViewDidLoad方法相关知识总结
- IOS -- ViewController的LoadView和ViewDidLoad方法相关知识总结
- iOS ViewController跳转界面的几种方法简单总结
- js 控制滚动条位置
- 创建提示语
- iOS 8 WkWebView 网页的配置和前进,后退,js 交互和进度条的加载
- ccf-201412-2 Z字形扫描
- Python微悟(一)
- 【iOS】判断viewcontroller 来源(展示出来)的4个方法
- Android中插件开发篇之----应用换肤原理解析
- extjs 必须项目前面红色星号
- Spring 学习笔记 (I) 之 Spring IoC
- UIAlertViewController的使用方法
- scheme,host,port,mimeType,path,pathPrefix,pathPattern用法
- 内存或磁盘空间不足,Microsoft Office Excel 无法再次打开或保存任何文档
- 快速开发框架dhroid的使用
- mysql进阶(十七)Cannot Connect to Database Server