// // OONoticationSettingController.swift // O2Platform // // Created by 刘振兴 on 2018/3/22. // Copyright © 2018年 zoneland. All rights reserved. // import UIKit import SnapKit class OONoticationSettingController: UIViewController,UIScrollViewDelegate { @IBOutlet weak var containerView: UIScrollView! @IBOutlet weak var pageControl: UIPageControl! private var pageImageNames:[String] = ["s1","s2","s3"] override func viewDidLoad() { super.viewDidLoad() title = "开启通知提示" self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "去设置", style: .plain, target: self, action:#selector(buttonClicked(_:))) initPage() } private func initPage(){ //容器 self.containerView.contentSize = imagesContentSize() self.containerView.isDirectionalLockEnabled = true self.containerView.delegate = self self.containerView.isPagingEnabled = true self.containerView.showsHorizontalScrollIndicator = false imageViews().forEach { (imageView) in self.containerView.addSubview(imageView) } self.pageControl.numberOfPages = pageImageNames.count self.pageControl.currentPage = 0 } @objc private func buttonClicked(_ sender:Any?){ let url = URL(string:UIApplication.openSettingsURLString)! UIApplication.shared.openURL(url) } private func imagesContentSize() -> CGSize { let sHeight = SCREEN_WIDTH let sWidth = SCREEN_WIDTH * CGFloat(pageImageNames.count) return CGSize(width: sWidth, height: sHeight) } // MARK:- 返回图片页视图列表 private func imageViews() -> [UIView] { var views:[UIView] = [] for index in 0..