2015-06-25 63 views
-1

當通過後退按鈕解除UIViewController時,是否有任何事件可以捕獲?當UIView被解僱時會發生什麼事件?

UIViewController正在退出時,我想寫幾個用戶默認值。

+0

我建議你閱讀關於視圖生命週期的Apple [文檔](https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/ViewLoadingandUnloading/ViewLoadingandUnloading.html)。 – ozgur

回答

-1

willMoveToParentViewController可能會在這裏你的朋友

Detecting when the 'back' button is pressed on a navbar

+0

「在通過後退按鈕解除UIViewController時」,在這個特定情況下,使用willMoveToParentViewController是一種方法,它是一個衆所周知的解決方案。 http://stackoverflow.com/questions/8228411/detecting-when-the-back-button-is-pressed-on-a-navbar/17551952#17551952 – Mikael

+0

然後,你應該解釋,在你的答案 - 你在這裏是什麼更適合作爲評論 – Paulw11

+0

好的,我編輯答案。 -1是錯誤的答案btw。 – Mikael

1

這兩種方法都viewWillDisappearviewDidDisappear應該在這個時候被調用。

相關問題