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()
}