UI: 无限循环UIScrollView


func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
        
        
        let index = Int(scrollView.contentOffset.x/scrollView.bounds.size.width)
        
        
        pageControl.currentPage = index
        
        let count = bannerArray?.count
        if index == 0 {
// 序号0,跳转到最后1页  
        
            self.scrollView.scrollRectToVisible(CGRectMake(375*CGFloat(count!-2), 0, 375, 189) , animated: false)
        
        }else if index == (count! - 1) {
最后+1,循环第1页  
            self.scrollView.scrollRectToVisible(CGRectMake(375, 0, 375, 189), animated: false)
        }
        
        
        
    }





你可能感兴趣的:(UI: 无限循环UIScrollView)