I'm making some apps with support for all three major iOS platforms: iPhone&Co, iPhone4 and iPad. This support means, naturally, having larger-resolution images for the latter two platforms. Currently I'm making the apps universal, so the same app will run in all of them.
Since most of the double-resolution images of the iPhone4 version of the app can be used as-is in the iPad version (only things like background images have to be made separately for all three types of platform due to differing screen resolutions; the rest can be done with simply laying out the elements appropriately in the iPad as compared to the iPhone4, using the same element images for both), it would be a huge waste of space to make separate images for the iPhone4 and the iPad, when these images would be completely identical. Thus it only makes sense to reuse the same "@2x"
; images of the iPhone4 on the iPad version of the app.
This worked nicely for a while. However, at some point quite suddenly (I don't really know what happened), Interface Builder started to completely refuse to see any image files with a "@2x"
; in their name. It won't show them on the drop-down menu where you select an image (eg. for an UIImageView or UIButton), and if you write it manually, it will refuse to show it (only showing the question mark image symbolizing a missing image file). The image will show ok when running the app, but IB simply refuses to acknowledge the existence of such images. If I rename the image such that I remove the "@2x"
;, then IB will accept it, but not if it has those characters.
As said, IB did see the "@2x"
; images at some point, but for some reason now it doesn't. (This is a bit of a mystery because I don't remember this happening after any kind of SDK upgrade or anything.)
This tells me that this is either 1) a bug in IB, or 2) intentional behavior, and the "@2x"
; images should not be "abused" in this way to create an iPad version of the app properly.
If hypothesis 2 is correct, then what is the proper way of using the same images in both the iPhone4 and iPad versions of the app? Duplicating the image files would be an enormous waste of space (the apps are quite graphics-heavy).
One "kludge" that comes to mind would be to create soft links for the images so that the iPad versions of the image files would just be soft links to the @2x
iPhone4 images. However, I don't know if the bundling mechanism of the iPhone SDK supports soft links (you can't add them to the bundle in xcode, at least), or if it will simply make copies of the images (in which case each such image will end up being stored twice in the bundle).