How can I rotate a ImageView a random degree from 0 to 360?
This code let´s me rotate it 180 degrees:
func rotateTimes(){
UIView.animateWithDuration(5, delay: 0.0, options: UIViewAnimationOptions.CurveLinear, animations: { () -> Void in
self.imageView.transform = CGAffineTransformRotate(self.imageView.transform, 180 * 0.0174532925)
}, completion: nil)
}
But I want to rotate random degree, not only 180 degrees.
I have tried:
func rotateTimes(){
let diceRoll = Int(arc4random_uniform(7))
UIView.animateWithDuration(5, delay: 0.0, options: UIViewAnimationOptions.CurveLinear, animations: { () -> Void in
self.imageView.transform = CGAffineTransformRotate(self.imageView.transform, self.diceRoll * 0.0174532925)
}, completion: nil)
}
But that doesn´t work..