如何以编程方式设置 swift、Xcode 中 UIPageViewController 的过渡样式?

How to programmatically set the transition style of a UIPageViewController in swift, Xcode?

我想在不使用情节提要的情况下以编程方式制作 UIPageviewController,我知道情节提要中有一个选项可以设置过渡样式,但我无法执行此操作。我基本上想在代码中将过渡样式设置为页面滚动。

我尝试了很多方法,但没有任何效果。

viewDidLoad() 函数之前的初始化中执行此操作:

override init(transitionStyle style: 
UIPageViewControllerTransitionStyle, navigationOrientation: UIPageViewControllerNavigationOrientation, options: [String : Any]? = nil) {
    super.init(transitionStyle: .whatever_style, navigationOrientation: .horizontal, options: nil)
}
required init?(coder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
}