如何正确动画UIView动画?

时间:2018-01-08 18:21:46

标签: swift uiscrollview uiviewanimation

我有一个UIScrollView,它有7个UIViews作为子视图。

使用UIView.animate方法,我将子视图从内容大小UIScrollView的左侧转换为结尾。

func animateScrollView(){
    if stopAnimation {
        print("Scroll View Animation Stopped")
    } else {
        print("Animating Scroll View")
        featureScrollView.setContentOffset(CGPoint(x: 0, y: 0), animated: false)
        featureScrollView.delegate = nil
        UIView.animate(withDuration: 10.0, delay: 0, options: [.curveLinear, .repeat], animations: {
            self.featureScrollView.contentOffset = CGPoint(x: self.subViewWidth * CGFloat(7)  - CGFloat(0), y: 0.0)
        }, completion: nil)
    }
}

我想让这个动画在上一次循环的UIView开始移动之后立即重复。因此,滑动UIView将始终在没有空格的情况下滑动。

任何想法如何实现这一目标?

0 个答案:

没有答案