ingh.am
ingh.am

Reputation: 26742

Rotate UIImage?

Can you rotate a UIImage without using a transform on UIImageView. I'm using a UIImage as a custom pin on a map and would like to rotate it if possible?

Upvotes: 5

Views: 1579

Answers (2)

Satish Azad
Satish Azad

Reputation: 2312

yess you can rotate and UIImage in predefined ImageOrientations:

UIImage *rotatedImage = [UIImage imageWithCGImage:imageObject.CGImage scale:imageObject.scale orientation:UIImageOrientationUp];

here orientation is predefined enum variable:

UIImageOrientationUp,
UIImageOrientationUpMirrored
UIImageOrientationDown
UIImageOrientationDownMirrored
UIImageOrientationLeft
UIImageOrientationRight    etc

it rotates UIImage.

Upvotes: 0

Brad
Brad

Reputation: 11505

No. The only thing you might be able to do is to set the UIImageOrientation to coheres the OS into rotating it for you on the basis of that - though that will only give you the four (main) 90-degree rotations.

Upvotes: 3

Related Questions