iPhone image distortion

Posted by Corey Floyd on Stack Overflow See other posts from Stack Overflow or by Corey Floyd
Published on 2009-01-24T16:40:24Z Indexed on 2010/06/06 17:32 UTC
Read the original article Hit count: 435

Are there any reasons why the simulator will display UIImageViews properly, but incorrectly on the iPhone?

My Process: An image in a PNG file Start a UIGraphicsBeginImageContext() Draw the PNG in a CGrect Draw text in the CGRect Create an UIImage from the context Set the image of a UIImaveView to the UIImage Set the frame of the UIImageView to the size of the PNG Add as a subview

Outcome: The image does not display correctly. The rightmost 1-3 pixels of the image is just a vertical white line. This occurs only on the device and not on the simulator. I can fix the problem, but only by increasing the size of the UIImageView. If I increase the size.height of the UIImageView by 1 pixel, it displays the UIImage correctly. Of course, these leaves the iPhone to scale my image before drawing it on screen which is not desirable.

Any ideas why this occurs or any fixes for it? (I will post my code if needed)

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk