Swift 4.2:如何在ViewController中嵌入UIPageControl(没有Storyboard)?

问题描述 投票:-3回答:1

有没有人有一个例子,如何在不使用PageController或故事板的情况下在ViewController中嵌入xib

使用UIPageControl正确的方法来构建以下?

enter image description here

ios swift uiviewcontroller uipageviewcontroller
1个回答
0
投票

标准技术是这样的:

    let pvc = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal)
    self.addChild(pvc)
    self.view.addSubview(pvc.view)
    pvc.view.frame = // whatever
    pvc.didMove(toParent: self)
    pvc.setViewControllers( //...
    pvc.dataSource = // ...
© www.soinside.com 2019 - 2024. All rights reserved.