Created
April 9, 2018 01:42
-
-
Save takashi1975/59d7065fb13d6fe68dfb69d38915bb30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewWillDisappear(_ animated: Bool) { | |
/** | |
* UINavigationControllerの戻る[back]処理のイベントを取得する方法 | |
* https://qiita.com/syamaoka/items/509ff50fcab485347600 | |
* ... viewWillDisappearが呼ばれる時に、戻る処理を行っていれば、NavigationControllerのviewControllersの中にselfは存在していない | |
*/ | |
if let viewControllers = self.navigationController?.viewControllers { | |
let existsSelfInViewControllers = viewControllers.filter{$0 == self}.count == 0 | |
if existsSelfInViewControllers { | |
Logger.log(message: "Test") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://qiita.com/motokiee/items/cf83b22cb34921580a52