0

I want to set background image of my iPhone app. I've created 3 dimensions images

  1. 320 * 480
  2. 640 * 960
  3. 640 * 1136

But when i set background then whole image is not showing. I mean width of the image is showing perfectly but height is not showing. 90% height is only showing in simulator and my iPhone.

I don't know what is the reason. I am new in iPhone. Please help me.

Thanks!
Shailesh

Amar
  • 13,202
  • 7
  • 53
  • 71
Shailesh
  • 109
  • 1
  • 1
  • 7

2 Answers2

1

You forgot you have a status bar, witch has 20 px. Also, if you are using a UINavigationBar, this one its 44px . See Some Examples:

**only with statusBar (20 px)

size background:

  1. -iPhone 3gs: 320x460
  2. -iPhone 4/4s : 640x920 (retina display)
  3. -iPhone 5 : 640x1116 (retina display)

**status bar + UINavigationBar (20px + 44 px)

size background:

  1. -iPhone 3gs : 320x416
  2. -iPhone 4/4s : 640x876 (retina display)
  3. -iPhone 5 : 640x1072

you should check this link: size screen iPhone

  • Hi Juan, Thanks for your reply. I got dimensions but i've doubt regarding Phone 4/4s : 640x920 (retina display). Actual dimension is 640 * 960 so, if we decrease 20 PX then it should be 640 * 940 ? Thanks! – Shailesh Jun 05 '13 at 16:39
  • @Shailesh Did you not read the comment on my answer? Retina displays have double the resolution, so the status bar is actually 40 pixels. I listed all the resolutions there too. – James Holderness Jun 05 '13 at 17:28
  • @Shailesh for retina display consist 2x resolution from the real. Check the link i post you will understand better... – Juan Munhoes Junior Jun 05 '13 at 18:28
  • It should read `3. -iPhone 5 : 640x1096 (retina display)` (-40px for retina) – oshevans Sep 30 '13 at 23:18
0

You need to allow for the status bar which is 20px. You could also turn off the status bar, but that is not recommended.

If you want the status bar to hidden, you need to set the UIStatusBarHidden property to true in your info.plist file.

<key>UIStatusBarHidden</key>
<true/>

That takes care of the status bar when the app is launching. If you also want it invisible after launch, then you need to call the following code:

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
James Holderness
  • 22,721
  • 2
  • 40
  • 52
  • Thanks for your reply. Can you please tell me how i need to set background image so, it takes 20px status bar also – Shailesh Jun 05 '13 at 13:34
  • Hi, I used [self setWantsFullScreenLayout:YES]; in - (void)viewDidLoad and it solved my issue. Thanks! – Shailesh Jun 05 '13 at 13:40
  • Oh ok. That's not what I was going to suggest, but as long as you're happy that's great. – James Holderness Jun 05 '13 at 13:43
  • Hi It will works if i change dimension 300 * 480 , 600 * 960 and 600 * 1136? I mean decrese 20px size – Shailesh Jun 05 '13 at 13:56
  • Keep in mind that on the retina displays it's actually 40 pixels. For portrait orientation it would be 320x460, 640x920, and 640x1096. For landscape orientation it would be 480x300, 960x600, and 1136x600. – James Holderness Jun 05 '13 at 14:04