Transition PageCurl to Scroll with UIPageViewController

霸气de小男生 提交于 2019-12-04 07:13:00

From the Apple Docs:

"The value of this property is set when the page view controller is initialized, and cannot be changed."

You must specify the transition style when you initialize. If you do that in code, you will need something like:

let pageViewController = ViewController(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil)

(Since ViewController is a subclass of UIPageViewController)

If you are setting up the Page View Controller in a storyboard, amend the transition style in the attributes inspector:

If you need to use storyboard and still need to set the transition style in code you can use this trick in the Class you made inheriting UIPageViewController. The trick is that in the init with coder you call super.init() which takes transition style like this

class ViewController: UIPageViewController {

    required init?(coder: NSCoder) {
        super.init(transitionStyle: Configs.transitionStyle, navigationOrientation: .horizontal, options: nil)
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!