Rotate a view for 360 degrees indefinitely in Swift?

后端 未结 10 1223
闹比i
闹比i 2020-12-05 13:06

I want to rotate an image view for 360 degrees indefinitely.

UIView.animate(withDuration: 2, delay: 0, options: [.repeat], animations: {
    self.view.transf         


        
10条回答
  •  渐次进展
    2020-12-05 13:46

    Try this one it works for me, i am rotating image for once

     UIView.animateWithDuration(0.5, delay: 0.0, options: .CurveLinear, animations: {
    
           self.imgViewReload.transform = CGAffineTransformRotate(self.imgViewReload.transform, CGFloat(M_PI))
    
     }, completion: {
        (value: Bool) in
    
              UIView.animateWithDuration(0.5, delay: 0.0, options: .CurveLinear, animations: {
              self.imgViewReload.transform = CGAffineTransformIdentity
    
             }, completion: nil)
     })
    

提交回复
热议问题