Marti Serra Vivancos Marti Serra Vivancos - 1 year ago 119
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...


Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download