Search code examples
iphoneobjective-ccocoa-touchios4image-rotation

How to programmatically rotate image by 90 Degrees in iPhone?


Possible Duplicate:
How to Rotate a UIImage 90 degrees?

How to programmatically rotate image by 90 Degrees in iPhone?


Solution

  • //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