Marti Serra Vivancos Marti Serra Vivancos - 5 months ago 29
Objective-C Question

How to rotate UIImage

I'm developing an iOS app for iPad. Is there any way to rotate a UIImage 90ยบ and then add it to a UIImageView? I've tried a lot of different codes but none worked...

Thanks!

Answer

You may rotate UIImageView itself with:

UIImageView *iv = [[UIImageView alloc] initWithImage:image];
iv.transform = CGAffineTransformMakeRotation(M_PI_2);

Or if you really want to change image, you may use code from this answer, it works.