packaging multiple resolutions in a universal iOS app

I'm writing a 3D iOS game in Unity3d, and can't find a complete and straightforward answer about including different texture sizes for different devices.

First up, I am making the assumption that a truly universal app will require 3 versions of each texture... (low res for non-retina iPhone/iPod, 2x res for retina iPhone/iPod and non-retina iPad, and now 4x res for retina iPad) I am also assuming that based on the apple-defined naming convention, downloading an app to a specific device will download only the appropriate textures. Otherwise downloading all three resolutions to an old non-retina phone would contain 95% deadweight.

The Apple documentation linked says to use "@2x" in the texture filename for retina devices, as well as "~ipad" or "~iphone" as appropriate for the device.

https://developer.apple.com/library/ios/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/SupportingHiResScreens/SupportingHiResScreens.html#//apple_ref/doc/uid/TP40010156-CH15-SW8

Assuming a low res atlas file of 1024x1024, and following the above naming convention, we'd now have to include four files per image, but two of those files are identical apart from the filename?

eg:

(1024 x 1024) myAtlas~iphone.png
(2048 x 2048) myAtlas@2x~iphone.png 
(2048 x 2048) myAtlas~ipad.png 
(4096 x 4096) myAtlas@2x~ipad.png 

Is this correct?

I guess my confusion stems from being able to easily use the same texture resolution for both non-retina iPads and retina iPhones/iPods since the screen resolutions are reasonably similar, but the naming convention Apple suggests does not seem to take advantage of that.

This will be my first published app on iOS, maybe I have missed some point entirely? or maybe some of my assumptions are wrong?


  • Yes, the naming convention doesn't provide a way for iPhone retina and iPad non-retina to share images.

  • The naming convention only applies to the UIImage class and related API. While you can load OpenGL ES textures from UIImage / CGImage , by no means are you required to. Name your files whatever you want, use the UIDevice class (or corresponding GL APIs) to determine the screen size, and locate the appropriate texture files yourself using the NSBundle class. (Also see the Apple sample code site for some examples of using PVR texture files.)

  • I'm afraid your assumption regarding what gets downloaded to the device is incorrect. The .ipa bundle you submit to the App Store gets downloaded unchanged to whatever device your user installs it on -- if you submit a universal app with resources for four different device resolutions, it'll install with all four sets of resources on the device even though three go unused.

  • 链接地址: http://www.djcxy.com/p/96686.html

    上一篇: 为所有iDevices设置1024 * 780图像

    下一篇: 在通用iOS应用程序中打包多个分辨率