LoginSignup
3
5

More than 5 years have passed since last update.

UIPageViewControllerで現在のページのクラス名を取得する

Posted at

UIPageViewCOntrollerのデリゲートメソッドですが、スワイプして、ページが止まった瞬間に呼ばれます。
また、finishedはアニメーションが終了したタイミング(遷移しようが遷移しまいが)
completedは遷移が完了したタイミングで呼ばれます。
遷移した場合、順番としてはfinishedが先です。


func pageViewController(pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
        if completed {
            let currentVC = pageViewController.viewControllers![0]
            print(currentVC.getClassName())
        }
    }

getClassNameは拡張しています。

3
5
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
3
5