How to rotate a UIImageView?

Posted by jkally on Stack Overflow See other posts from Stack Overflow or by jkally
Published on 2010-12-11T22:16:16Z Indexed on 2011/01/01 6:53 UTC
Read the original article Hit count: 237

It's quite frustrating not to be able to do such a simple task: I have an "app" with a single viewcontroller, and in it a single UIImageView, that's initialized to a specific image at potrtait mode.

Now when the iPhone gets roteated to landscape mode and the shouldAutorotateToInterfaceOrientation event fires, at which I return YES, my resulting UIImageView looks totally screwed up: either the image is stretched so to fill landscape mode frame (which looks ridiculuous of course) or the top and bottom of the image are cropped.

How can I have my UIImageview and the contained image handle the device rotation gracefully, and display normal looking image at landscape mode as well?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c