【问题标题】:How to programmatically set the transition style of a UIPageViewController in swift, Xcode?如何以编程方式在 Xcode 中快速设置 UIPageViewController 的过渡样式?
【发布时间】:2019-05-20 00:01:42
【问题描述】:

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

我尝试了很多东西,但没有任何效果。

【问题讨论】:

    标签: swift xcode uipageviewcontroller


    【解决方案1】:

    在你的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")
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-07
      相关资源
      最近更新 更多