Black bars showing when running app on iOS 7 (4 inch retina display)
Asked Answered
P

5

60

We have an iPod app built with base SDK as 5.1. App has a tabBarController with three tabs and each tab has a UIViewController to load a different view.

The app works fine for iOS 6.1 and iOS 7 (3.5 inch display) simulator and device but when we run the app on iOS 7 (4 inch display simulator) or device we are getting black bars at the top and bottom of the view screen in all three tabs. If anyone can suggest reason for this or some feasible solution to this problem, it would be really helpful for us.

Thanks

Petrick answered 20/9, 2013 at 9:20 Comment(5)
Please add an image of this issue.Bunnybunow
did you ever try to run your app on any version of ios on 4' inch hardware? you need to say ios your app support 4 inch display.Monostome
@Denis - Yeah we have tried it. It is working fine on 3.5 screen only. For 4 inch screen it gives black bar on top and bottom of screen for that extra .5 inch.Petrick
@Nitin - We are still trying it. Will update soon.Petrick
@Nithin, Yeah. Sorry for the delay. We were stuck with some other issue after that. Your fix worked. Thanks a lot.Petrick
C
105

First thing is that you must add the required default image for 4 inch screen display. Check Properly in you project have image with name [email protected] (640 × 1136 pixels)

This [email protected] is Necessary for Support app in 4 inch Screen display

Ones you add this image in to you working Project, Remove old Build from device or Simulatore, clear Project and re build and check Hope you issue will solve.

Edit:-

After fix the black Bar issue you can check the device like my answer Give here check this:-

Detect device type

you have two choice if you can't use AutoLayout

First

Create two xib with same class one for 3.5 inch screen and one for 4 inch screen set using macro with checking which screen appear.

Second

Set Self.view frame using macro with checking which screen appear.

There are also other methods you can use for set self.view frame as using window frame or UIScreen

Cymogene answered 20/9, 2013 at 9:23 Comment(6)
After adding this image, black bars that were coming on both top and bottom got fixed but now we are seeing white space in the view controller. I have tried to use -Autoresize layout but it gives me compilation error because my app is having base sdk as ios 5.1 and autoresize is available after ios 6.Petrick
iPhone Retina (4-inc) IOS 6.0 simulator works fine but IOS 7 simulator doesn't work. I cleared project, delete drived data and also Reset Content and Settings but not work :(Magnesia
This worked perfectly... what could possibly be the reason for this?Apocarp
For some reason the iPhone Simulator seems to detect the lack of a default image, and scale the available view size for the iPhone 5, which is 1136 pixels high, DOWN to what would be available for an iPhone4, 960 pixels high. Seems like an iOS bug...Nydia
I already had a [email protected] image in my project but had to add iOS 6 class images before it was fixed. Odd though since my project has 8.1 as the base version.Electrode
Thanks. This worked. In my case I was using Asset Catalogs and a launch screen file within App Icons and Launch Images. While there were no black bars, the layouts on iphone 6/iphone 7 didn't resolve as expected. By removing the Asset Catalogs and the Launch Images, and including the [email protected] all layouts on all devices are fine. And no black bars.Dish
E
63

My problem was I accidentally deleted the value found here:

enter image description here

I added back LaunchScreen, and made sure there was a LaunchScreen.xib. Maybe it will help some others.

Erenow answered 11/10, 2014 at 15:47 Comment(3)
I am using LaunchScreen and it works for every device and iOS except iOS 7.x + iPhone 5/5s combination :(Electrician
After trying a number of solutions involving asset catalog and addition of splash screen images with different size and all. Finally your tip worked for me. Since I was building the iOS app through Kony, there was no Launchscreen.xib originally. I created one and set it using the project settings. This solved the black bar issue for me. Thanks a tonVictualage
Yes, and I made the same mistake deleting that line. I'm pretty sure I followed some article online to delete that line.Posner
B
3

Ive had the same problem - black bars at the top and bottom. It was simply solved by setting the drop down in "App Icons and Launch Images" to Main_iPhone:

App Icons and Launch Images Screen Shot

Beastings answered 31/10, 2015 at 17:58 Comment(0)
I
1

I was facing same problem . I just added launch image and it worked for me.

XCode->Click on Project File -> Select Target-> App Icons and Launch Images -> Add launch image source

Inelegance answered 14/4, 2015 at 6:17 Comment(0)
C
1

This worked!

Pay attention to Step#5 and Step#6 below:

1.In xcode, Click on the Project file in Project Navigator
2.Click General tab
3.Type "Main_iPhone" in the Launch Screen File field
4.Save
5.Remove the app from device or simulator
6.Then in Xcode go to Product Menu and then select Clean 
7.Build again 
Campball answered 24/12, 2015 at 0:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.