UIPageController
UIPageController
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.lightGray
let page = UIPageControl(frame: CGRect(x: 20, y: 100, width: 280, height: 30))
page.currentPageIndicatorTintColor = UIColor.red
page.addTarget(self, action: #selector(ViewController.changeNum), for: .valueChanged)
page.numberOfPages = 8
self.view.addSubview(page)
}
@objc func changeNum(page: UIPageControl) {
print(page.currentPage)
}
}
本文标题:UIPageController
本文链接:https://www.haomeiwen.com/subject/yqhngqtx.html
网友评论