-1

I have this code for rotate image view:

func rotateAgain(){
    UIView.animateWithDuration(1.0,
        delay: 0.0,
        options: .CurveLinear,
        animations: {self.imageView.transform = CGAffineTransformRotate(self.imageView.transform, 1.degreesToRadians)},
        completion: {finished in if self.rotating { self.rotateOnce() }})
}

What is wrong in the code?

Torre Yan
  • 223
  • 3
  • 9

1 Answers1

0

The second argument for the CGAffineTransformRotate is for the angle, but it is in radians, if you want to transform radians to degrees, you have to multiply the angle in degrees with 0.0174532925

Example for rotating for 240 degrees:

CGAffineTransformRotate(self.imageView.transform, 240 * 0.0174532925)
Dejan Skledar
  • 11,280
  • 7
  • 44
  • 70