views:

154

answers:

2

So I'm building an app for 4.x devices and I'm wondering if I can just use one set of assets at double resolution instead of one set with a @2x id and another set without.

Basically im asking can the older 3g and 3gs just use the @2x assets? and do the right thing with them?

anyone have experience with this?

Thanks

+1  A: 

They technically can, given you make sure they're scaling the right way (e.g. if it's an image view that it's set to scale up/down).

However it's not recommended in most situations, mainly because it'll be slower, uses more resources, and leads to shorter battery life. Also, depends on your resources but an artwork scaled down by a factor of 2 doesn't have the same quality as one that is resampled specifically for the new size.

Mo
That is a bit confusing.. how can something that is scaled down (meaning they had all the pixel data they needed to smoothly scale it down) be worse quality than something they scaled up (meaning they had to guess at pixel data and effectively "fill in the blanks")
iWasRobbed
i think he means that if you scale the image in photoshop, the resulting image will be smoother than if you leave the scaling operation to the device/os.
nickthedude
too bad there isn't an easy way to have the app resize the images once downloaded, because im using a ton of images and to duplicate each image even scaled down will really bloat my bundle. would be nice to do it lazily over several runtimes.
nickthedude
Exactly what Nick said. If your image is scaled down before down you usually have more control on the output; or how you want to create it in the first place.You could consider vector-based graphics at some places. It'll probably make life easier in the long run.
Mo
+2  A: 

You're better off using two sets of resources, one for the high resolution retina displays and one for the older displays. Downsizing @2x graphics won't look pretty and will impact performance, especially on 2G iPod Touches.

The older devices can use the @2x but as far as I understand you'll need to:

  1. Set your UIImageViews to scale the images to fit.
  2. Hardcode image references to the new images.
  3. Expect poor image quality and slower performance on non-retina devices.

Overall, it's better to provide two copies of the images, "bob.png" and "[email protected]" then reference them in code as "bob.png".

NB. As of iOS4 you can reference the images without their file endings, so just "bob" would work; however this has compatibility implications with devices running pre-iOS4 : the images won't be found. So for maximum compatibility include the file endings if you intend on deploying to both iOS4 and iOS3.x.

xmr