简体   繁体   中英

Swift 4.2: How to embed UIPageControl in ViewController (without Storyboard)?

Does anyone have an example of how to embed a PageController within a ViewController without using a xib or storyboard?

Is using a UIPageControl the right approach to build the following?

在此处输入图片说明

The standard technique is along these lines:

    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 = // ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM