LoginSignup
23
20

More than 5 years have passed since last update.

[Swift] 戻るボタンのタップイベントを検知したい時

Last updated at Posted at 2015-09-22

やること

Swift でNavigation Barの戻るボタンタップイベントを検知する

実装

下記コードを遷移元のViewController内に記述する

Swift2.0
override func didMoveToParentViewController(parent: UIViewController?) {
    super.willMoveToParentViewController(parent)
    if parent == nil {
        print("戻るボタン is tapped")
    }
}
23
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
20