ios7 - iPhone 5 giving white space at the top

2019-01-26 00:50发布

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.

2条回答
三岁会撩人
2楼-- · 2019-01-26 01:07

It's due to the status bar.

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

enter image description here

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) :

enter image description here

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.

查看更多
闹够了就滚
3楼-- · 2019-01-26 01:20

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.

查看更多
登录 后发表回答