ios7 - iPhone 5 giving white space at the top

2019-01-26 00:46发布

问题:

Client has come back to me on projects saying they see white space on the top (they can't see the default things like time, wifi signal, etc) at the top.

This is happening when they installed iOS7 on their iPad.

Any idea why this is happening?

Note:

I have navigation bar as image. I hide the navigation bar and put navigation bar as an image.


Downvoters

I know this is not a perfect question for SO, but I thought to ask to take inputs. Tomorrow I am going to study on it.

回答1:

try to insert following code into your viewDidLoad:

if( [self respondsToSelector:@selector(edgesForExtendedLayout)] ) {
  self.edgesForExtendedLayout = UIRectEdgeNone;
}

Otherwise you could try it, by removing the UIStatusBar. Select your Project, go to the section General and select Hide during application launch inside the subsection Deployment Info. Next you have to add the attribute inside the Info section called View controller-based status bar appearance and set it to NO.



回答2:

It's due to the status bar.

In your XIB or Storyboard chose to view your xib as iOS 6 :

On your view, add a Content View (you will add your outlets elements inside this content view) and add a Y delta of 20 (for the status bar) :

Now, if you compile your app on iOS 7 or iOS 6, your view will go up or down and you won't have the space anymore.