Search code examples
iphoneuibuttoncore-animationrotationcakeyframeanimation

Rotate UIButton randomly on screen


I want to rotate a button randomly on a screen. No specific path defined it can move randomly on a view.

I dont want to use CAKeyframeAnimation. It should be clean and simple.

Can anyone guide me ?


Solution

  • Animate the button's transform property using CGAffineTransformMakeRotation() and combine it with an NSTimer with a random time interval.