Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
494 views
in Technique[技术] by (71.8m points)

ios - How to support various iphone screen sizes as of 2014?

I'm almost done building my first iPhone app and am trying to add a background image, and am finding it a little confusing, because nowadays there's like 3 or 4 different size screens among the different iPhone versions, with different resolutions to boot.

So while I'm aware of the whole [email protected] thing, I still don't know what I really need. If I want my app to run on iPhone 4/4s, 5s/5c, 6/6+, how many different versions of a background image do I need, and at what sizes and resolutions?

I have googled around and have not found any cohesive answers up to date for 2014.

Also, if the iPhone 6 is 1334x750 @3x, does that mean I'm supposed to include a 4002x2250 background? And then for the 1920x1080 iPhone 6+ @3x, a 5760 x 3240 image? That's MASSIVE! I feel like I must be understanding this incorrectly.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think the easiest way to do this is to use an image that fits on iPhone 6+ and then simply set UIImageView's contentMode to UIViewContentModeCenter. I think it's that one at least, the result should be that on iPhone 6+ you have a centered image but on the other screens you simply get a part of the image.

The downsampling of the iPhone 6+ means that an @3x asset covering the entire screen should be 2208x1242 (That is, this resolution is already 3x. The "real" resolution is 736x414). This is the largest resolution needed and you can then use the same image for @2x and @1x assets using the method I described.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...