UIImageView PNG pixelation on iOS simulator and device

This can be a very simple problem, but I stuck with it for a week. I am using UIImageView to display a PNG image with a Dropbox image. I can see it well in the Builder interface, but it's easy to notice the strong pixelation in the iOS Simulator and on the device itself (iPad). Here I am attaching an IB screen capture along with a simulator:

On the left the IB.  On the right the simulator.  Notice the pixelation.

I would really appreciate any hint.

Thanks in advance!


source to share

2 answers

InterfaceBuilder is a completely different environment than iOS or even a simulator. The layout and the like should be translated, but the way things look should always be appreciated (and therefore intended for) the final product.

It looks like your image is stretching slightly. There are several reasons for this. The first thing to check is resize the mask on your UIImageView. Generally bad for UIImageViews to parse automatically - for this very reason.

By the way, autoresistance is UIKit to make sure the subviews still fit / look good when their parent view is resized. You can specify how much you want to move the subview, as well as how much you want to stretch. Read about it here .

What you want to do is project your opinion - answer the question: how much do I want this image to be in the final product? - and then make the actual png that size (also create a @ 2x variant which is twice the size for retina displays). Then when you build in IB, make your UIImageView the same size and make sure the autoresist settings are set to disallow stretching.

This should fix your problem.



Make sure the image is sized to fit your UIImageView. If the image is smaller than the target image, it will stretch to fill it, which can cause pixelation. Also, if you're using the new iPad 5.1 simulator, it will default to the new retina screen, which means you'll need @ 2x sized images to prevent pixelation.



All Articles