Swift Continuous Rotation Animation not so continuous

前端 未结 3 1895
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-04 18:59

Here is my code. Intent is to continuously rotate the UIImageView named swirls[l]. However, there is a small pause between every rotation start/end. I have gone through every si

3条回答
  •  走了就别回头了
    2021-02-04 19:36

    I'm not sure what's wrong with your code, but I've implemented continuous rotation using this method,

    @IBAction func rotateView(sender: UIButton) {
        UIView.animate(withDuration: 0.5, delay: 0, options: .curveLinear, animations: { () -> Void in
            self.spinningView.transform = self.spinningView.transform.rotated(by: .pi / 2)
        }) { (finished) -> Void in
            self.rotateView(sender: sender)
        }
    }
    

提交回复
热议问题