/PagingScrollView

Custom ScrollView's page size,not associated the bounds

Primary LanguageSwift

PagingScrollView

Custom ScrollView's page size,not associated the bounds

effect picture:

horizontal

vertical

Usage

        //horizontal 
        let count = 5
        let size = self.view.frame.size
        scrollView = PagingScrollView(frame: CGRect(x: 0, y: 0, width: size.width, height: size.height))
        scrollView.delegate = self
        scrollView.customPagingEnabled = true
        
        //水平分页 - horizontal
        scrollView.pageWidth = pageWidth
        scrollView.contentSize = CGSize(width: pageWidth * CGFloat(count), height: size.height)
        self.view.addSubview(scrollView)
        //vertical
                let count = 5
        let size = self.view.frame.size
        scrollView = PagingScrollView(frame: CGRect(x: 0, y: 0, width: size.width, height: size.height))
        scrollView.delegate = self
        scrollView.customPagingEnabled = true
        
        //垂直分页
        scrollView.pageHeight = pageHeight
        scrollView.contentSize = CGSize(width: size.width, height: pageHeight * CGFloat(count))
        self.view.addSubview(scrollView)