简体   繁体   English

知道何时在Apple Watch Modal Interface Controller中单击取消按钮

[英]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.

相关问题 Apple Watch情节提要:不支持的配置-模态控制器无法访问接口控制器 - Apple Watch Storyboard: Unsupported Configuration - Interface Controller is unreachable for a modal controller 如何更新/刷新Apple Watch接口控制器? - How to update/refresh an Apple Watch Interface Controller? 如何修复Apple Watch中页面Controller内缺少的接口controller? - How to fix missing interface controller inside Page Controller in Apple Watch? 苹果手表界面 - Apple watch interface 当我使用StoreKit的requestReview功能时,有没有办法知道用户是否点击了提交或不立即或取消按钮? - When I use requestReview function of StoreKit, is there any way to know if the user has clicked on Submit or Not Now or Cancel button? 当按下Apple Watch时计算百分比 - Calculate Percentage when Button is Pressed Apple Watch 来自Apple Watch中模态segue的标签“取消”显示错误的文字 - “abbrechen” - The label “Cancel” from modal segue in Apple Watch showing wrong text - “abbrechen” 如何在Apple Watch中更改模态segue中的“取消”标签 - How can I change the label “Cancel” from modal segue in Apple Watch UISearchDisplayController - 单击取消按钮的方法 - UISearchDisplayController - Method for when cancel button is clicked 有没有办法知道何时在Apple Pay视图中按CANCEL - Is there a way to know when CANCEL is pressed in the Apple Pay view
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM