UIPageViewController

UIPageViewControllerDelegate

    /// 手势开始时触发
    /// - Parameters:
    ///   - pageViewController:
    ///   - pendingViewControllers: 
    func pageViewController(_ pageViewController: UIPageViewController, willTransitionTo pendingViewControllers: [UIViewController]) {
        <#code#>
    }
//当手势启动的转换结束时发送。
//“finished”参数指示动画是否完成,
//而“completed”参数指示转换是完成还是退出(如果用户提前放手)。

@available(iOS 5.0, *)
    optional func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool)
/// 手势动作发起的动画结束时触发
    /// - Parameters:
    ///   - pageViewController:
    ///   - finished: 动画是否完成
    ///   - previousViewControllers: 
    ///   - completed: 翻页动作是否完成【用户是否取消了动作】
    func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
        
    }
/// 设置书脊的位置,当时翻页类型时在init方法中设置书脊位置会引起闪退
    /// - Parameters:
    ///   - pageViewController: 
    ///   - orientation: none、min、mid、max
    func pageViewController(_ pageViewController: UIPageViewController, spineLocationFor orientation: UIInterfaceOrientation) -> UIPageViewController.SpineLocation {
        return .min
    }

UIPageViewControllerDataSource

/// 前一页
    /// - Parameters:
    ///   - pageViewController: <#pageViewController description#>
    ///   - viewController: <#viewController description#>
    func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController?
/// 后一页
    /// - Parameters:
    ///   - pageViewController: <#pageViewController description#>
    ///   - viewController: <#viewController description#>
    func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController?

你可能感兴趣的:(UIPageViewController)