[英]Know When Cancel Button is Clicked in Apple Watch Modal Interface Controller
Is there a way to know if the cancel button is pressed by the user if the interface controller was displayed modally? 有没有办法知道用户是否以模态显示了接口控制器的取消按钮? Let's say you want to do something before the interface controller is dismissed.
假设您要在关闭接口控制器之前做一些事情。
The only method available is -didDeactivate
. 唯一可用的方法是
-didDeactivate
。 This will get called when the screen will disappear or when the app will close. 当屏幕消失或应用程序关闭时,将调用此方法。 Unfortunately, there is no direct way to know when the cancel button is pressed.
不幸的是,没有直接的方法知道何时按下取消按钮。
If you need to do some things when the controller will be dismissed you can also call deinit
eg ; 如果在关闭控制器时需要做一些事情,也可以调用
deinit
例如;
deinit {
doStuff()
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.