Interface Builder can't render 160dpi images correctly?

I am developing an iPhone application. A simple image is the background of the main view. I have set UIImageView in background and set image using IB.

the image is a 160dpi PNG image. This is similar to CRAP in IB. When working in a simulator, this is normal, crisp.

How am I supposed to work and place my controls exactly on such a poor resolution image? This is mistake?

Thanks for the help!

+1


source to share


4 answers


IB is not a tool for developing a user interface, it is a tool for implementing it. It's designed to work well, not display well (this is more important in complex desktop designs than mobile, but the tool is the same for both). The best advice is perhaps to cue in the publishing world (where it is common practice for applications that display large amounts of high-resolution graphics, such as Adobe InDesign) and keep track of the exact measurements for controls - x, y and height / width coordinates. Then you can use the inspector to accurately position the controls.



+2


source


In fact, DPI doesn't matter at all.



Change DPI to 72 and the image will display in IB / Xcode format.

+2


source


I don't see anything like this when I work with images in IB. Maybe there is something special about your PNG file? You say it's 160 dpi, which is pretty inappropriate. More important is what its pixel diameters are, and how they compare to screen size.

Perhaps the UIImageView is having problems rendering your PNG and is using the preview icon for some reason? Try another image or try resizing the image to 480x320 with 32-bit color.

0


source


I'm wondering about this too. I don't think the DPI of the image is what does this, because I have a project where everything looks good in IB on one machine and then on my laptop displays the OP's way of describing it.

The image dimensions are the same as the iPhone screen and the view dimensions (320x480), but the image displays everything tiny rather than filling all the digital elements of the UIImageView. If I scale to fill then the image becomes all blurry, at 320x480, although I can confirm that these are the actual dimensions of the image ... It acts as if the 320x480 image itself is from empty space with a small version of my image centered inside it. .. It is very strange. As I said, this is the same project that looks great in IB on a different machine (and when they are built, they both look fine in the simulator). This also happens on my macbook friends.

Is there some setting in IB that could be the difference?

EDIT: I guess I spoke too early - I went back to my other machine and noticed the same problem this time and it really was dpi. This must have been a change in one of the latest xcode / IB updates because I never initially saw this issue and the image files are exactly the same ... weird.

0


source







All Articles