Know When Cancel Button is Clicked in Apple Watch Modal Interface Controller

自闭症网瘾萝莉.ら 提交于 2019-12-11 12:57:33

问题


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.


回答1:


The only method available is -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.




回答2:


If you need to do some things when the controller will be dismissed you can also call deinit e.g. ;

  deinit {
    doStuff()
  }


来源:https://stackoverflow.com/questions/30047526/know-when-cancel-button-is-clicked-in-apple-watch-modal-interface-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!