UIAnimate only happens once on button

后端 未结 1 1023
闹比i
闹比i 2021-01-26 03:20

I have a button in my app that has a background image. When the button is pressed I want it to rotate 90 degrees. The code below is my IBAction. It works perfectly the first tim

相关标签:
1条回答
  • 2021-01-26 03:35

    You always set the transform to 90 degrees. If you want to rotate an additional 90 degrees each time you tap the button you need to update the existing transform.

    sender.transform = sender.transform.rotated(by: CGFloat(Double.pi / 2))
    
    0 讨论(0)
提交回复
热议问题