美文网首页
UIPageController

UIPageController

作者: 79d12e22ec53 | 来源:发表于2019-04-24 18:01 被阅读0次

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