views:

744

answers:

4

Hi !

I'm developing an iPhone app. A simple image is the background of the main view. I've set an UIImageView in the background and set an image in, using IB.

the image is a 160dpi PNG image. It appears like CRAP in IB. When running in the simulator it is ok, crisp.

How am I supposed to work and place my controls precisely on a such poor resolution image ? Is this a bug ?

Thanks for you help!

+2  A: 

IB is not a tool for designing a UI, it is a tool for implementing one. It is designed to perform well rather than display well (this is more important in complex desktop UI design than mobile but the tool is the same for both). The best advice is perhaps to take a cue from the publishing world (where this is a common practice for applications that display large amounts of high resolution graphics such as Adobe InDesign) and keep track of exact measurements for controls - the x,y coordinate positions and height/width. Then you can use the inspector to precisely position controls.

wisequark
A: 

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

Maybe the UIImageView is having trouble rendering your PNG, and is for some reason using the preview icon instead? Try a different image, or try resizing your image to 480x320, with 32-bit color.

Mark Bessey
+2  A: 

Actually, the DPI is not irrelevant at all.

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

Jonathan G.
A: 

I am wondering about this as well. I don't think the DPI of the image is what is doing this, because I have a project where everything looks fine in IB on one machine, then on my laptop, it displays the way the OP is describing.

The image dimensions are the same as the iPhone screen and the view dimensions (320x480), but the image displays all tiny instead of filling up the whole dimeal nsions of the UIImageView. If I scale to fill, then the image gets all blurry, at 320x480, even though I can confirm that those are the actual dimensions of the image... It's acting as if the image itself is 320x480 of empty space with a small version of my image centered inside it... this is very strange. As I said- this is the same project that looks completely fine in IB on another machine (and when they build, they both look normal in the simulator). This also happens on my friends's macbook.

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

EDIT: Guess I spoke too soon- I went back to my other machine and noticed the same problem this time, and it indeed was the dpi. This must have been a change in one of the recent updates to xcode/IB, because I originally never saw this issue, and the image files are exactly the same... strange.