开发者

Preparing graphic assets for a universal app

From what I've read elsewhere, Apple recommends multiple versions of every graphical asset, so quality will be 开发者_JS百科retained between pre-iPhone 4, iPhone 4 (with the retina display), and the iPad. But I'm using a technique that only requires one asset for all three cases.

I make each graphic the size I need for the iPhone 4 and the iPad, say a cat at 500x500 pixels. I name it myCat@2x.png. When I read it in for the iPhone:

CGRect catFrame = CGRectMake(0.0f, 0.0f, 250.0f, 250.0f);
UIImageView *theCat = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myCat"]];
theCat.frame = catFrame;
[self.view addSubview:theCat];
[theCat release];

for the iPad, I do exactly the same thing, except for:

CGRect catFrame = CGRectMake(0.0f, 0.0f, 500.0f, 500.0f);

This seems to work fine in all three cases, and greatly reduces the number (and size) of graphic files. Is there anything wrong with this technique?


Check this: http://vimeo.com/30667638 We are releasing it soon. If you are interested in beta testing it drop me a lineEdit


This question has been a long time in circulation, so I will "answer" it based on my experience with the last couple of apps I've worked on.

I see no reason to have a separate image asset for retina display and non-retina display iPhones. The technique I outlined above seems to work just fine.

Probably, one will want a separate asset ("resource file") for the iPad, mostly for the change in aspect ratio of the screen. In my case (sprites for children's games) I was able to use many of the iPhone images on the iPad. The "look" was a little different, but I saved a lot of file space.

Whether this works for you will, of course, depend on the unique properties of your project.


Not all images scale well, even at 50%. dithering or patterns might get distorted. In general, scaling at factors of 1/2, 1/4 etc (dividing by two) will result in best results, but scaling down using an advanced algorithm like used in Photoshop will produce better results.

So, in most cases, this can produce acceptable results.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜