Rotate UIButton 360 degrees

后端 未结 8 879
青春惊慌失措
青春惊慌失措 2021-02-07 01:52

I\'ve been trying to run an animation that rotates my UIButton 360 degrees using this code:

UIView.animateWithDuration(3.0, animations: {
  self.vin         


        
8条回答
  •  梦如初夏
    2021-02-07 02:10

    Swift 4: Animation nested closure is better than animation delay block.

    UIView.animate(withDuration: 0.5, animations: { 
      button.transform = CGAffineTransform(rotationAngle: (CGFloat(Double.pi))) 
     }) { (isAnimationComplete) in
    
           // Nested Block
    UIView.animate(withDuration: 0.5) { 
       button.transform = CGAffineTransform(rotationAngle: (CGFloat(Double.pi * 2)))
           }    
    }
    

提交回复
热议问题