swift-懒加载

    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.cyan
        self.navigationItem.title = "滚动视图"
        self.view.addSubview(self.scrollView)
    }
    
  fileprivate  lazy var scrollView:UIScrollView = {
        
        let Scroll:UIScrollView = UIScrollView.init(frame: UIScreen.main.bounds)
        Scroll.contentSize = CGSize.init(width:kScreenW*3,height:kScreenH)
        Scroll.contentOffset = CGPoint.init(x: 0 , y: 0)
        self.automaticallyAdjustsScrollViewInsets = false
        Scroll.showsHorizontalScrollIndicator = false
        Scroll.showsVerticalScrollIndicator = false
        Scroll.isPagingEnabled = true
        Scroll.isScrollEnabled = true
        Scroll.bounces = false
        Scroll.delegate = self    
        return Scroll
    }()

 

 

posted @ 2016-12-27 13:25  代码始我快乐  阅读(192)  评论(0编辑  收藏  举报