How to programmatically rotate image by 90 Degrees in iPhone?

Parth Bhatt picture Parth Bhatt · Apr 7, 2011 · Viewed 59.8k times · Source

Possible Duplicate:
How to Rotate a UIImage 90 degrees?

How to programmatically rotate image by 90 Degrees in iPhone?

Answer

Sabobin picture Sabobin · Apr 7, 2011
//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