0

In the assets catalog, there is a background image in "Retina 4 2x". It is 640x1136 which is fullscreen in iPhone 5/5s.

background image

Then I find the image is also fullscreen in iPhone 6/6+.

I've read ultimate-guide-to-iphone-resolutions. I think fullscreen should only be on iPhone 6 display zoom because it is upsampling from iPhone 5/5s. Am I right?

I'm new in iOS dev and very confused on this problem. Can you help to explain this to me? Thanks.

====update====

I'm using Auto Layout. The background imageView's Size inspector:

images's Size inspector

goofansu
  • 2,277
  • 3
  • 30
  • 48

1 Answers1

2

If you want to use a UIImageView as a background image view, you'll first need to make some adjustments to your AutoLayout setup (based on the screenshot you posted). You've centered the view, which is a good start, but in order for the width and height to hug the borders, you'll need to specify that it hug the borders. When you do this, you'll find that you won't need the centering constraints anymore. Note that if you're not using Storyboards, the "Top/Bottom Layout Guides" will be "Superview" instead:

AutoLayout setup

In your Asset Catalog, under iOS 8 for iPhone with status bar hidden, you will want these images:

  • w:640, h:960 (4s @2x)
  • w:640, h:1136 ({5, 5s, 5c} @2x)
  • w:750, h:1334 (6 @2x)
  • w:1242, h:2208 (6 plus @3x)

If you're finding that your iPhone 5 image is being used on the iPhone 6 and 6 plus, it's likely that you didn't specify a Launch Image for the iPhone 6 device. If you don't specify a Launch Image for iPhone 6, your iPhone 5 assets will be used. If you don't want to specify a Launch Image, use a Launch Screen (targeting iOS 8+ only).

Finally, looking at the screenshot of your image, I bet you could use a gradient in a UIView instead of saving images in all these different resolutions with or without status bars. Here's a relevant StackOverflow question.

Community
  • 1
  • 1
greg
  • 4,843
  • 32
  • 47
  • Yes, I didn't specify Launch Image, that is the cause of this problem. And many thanks for the reference links, very helpful. – goofansu Feb 08 '15 at 15:23