每当滑动 UIPageViewController 时调用什么函数?

What function is called whenever a UIPageViewController is swiped?

每当滑动 UIPageView 时,我需要执行另一个函数。

符合UIPageViewControllerDelegate并实现以下方法:

func pageViewController(UIPageViewController, willTransitionTo: [UIViewController]) {
    // called when swiping begins
}

func pageViewController(UIPageViewController, didFinishAnimating: Bool, previousViewControllers: [UIViewController], transitionCompleted: Bool) {
    // called when swiping ends
}

查看 UIPageViewControllerDelegate。您可能正在寻找 pageViewController(_:didFinishAnimating:previousViewControllers:transitionCompleted:)