How can I make uiscrollview infinite in iOS?

后端 未结 8 1374
天涯浪人
天涯浪人 2020-12-08 01:27

I want to scroll like that 1 2 3 1 2 3

I have some buttons suppose 10 which i want to show on endless scroll.

 numbercolors=[[NSMutableArray alloc         


        
8条回答
  •  无人及你
    2020-12-08 01:55

    For right infinite scroll you can use -

            let rightOffset = CGPoint.init(x: (scrollView.contentSize.width) - (scrollView.bounds.width), y: 0)
        UIView.animate(withDuration: 3.0,
                       delay: 0.0,
                       options: [.curveLinear, .repeat],
                       animations: { () -> Void in
                        self.scrollView.contentOffset = rightOffset
    
        }, completion: { (finished: Bool) -> Void in
            self.scrollView.setContentOffset(.init(x: 0, y: self.scrollView.contentOffset.y), animated: false)
        })
    

提交回复
热议问题