Possible Duplicate:
How to Rotate a UIImage 90 degrees?
How to programmatically rotate image by 90 Degrees in iPhone?
So, Let's get started, Step 1 − Open Xcode→SingleViewApplication→name it RotateImage. Step 2 − Open Main. storyboard, add UIImageView and add 2 buttons as shown below name them ROTATE BY 90 DEGREES AND ROTATE BY 45 DEGREES.
//create rect UIImageView *myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"my_image.png"]]; //set point of rotation myImageView.center = CGPointMake(100.0, 100.0); //rotate rect myImageView.transform = CGAffineTransformMakeRotation(M_PI_2); //rotation in radians
see this:
Rotate image in Quartz? Image is upside down! (iPhone)
myImage.center = CGPointMake(0, 0); myImage.transform = CGAffineTransformMakeRotation([degreesToRadians:imageRotationFix]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With