iOS 7 Status Bar Collides With NavigationBar using

2019-09-03 16:54发布

问题:

I am a beginner with iOS development. Currently I have migrating a ios5 code to the ios7.

Getting the following overlap issue in my code : http://s17.postimg.org/90m7mx5lb/collide.png

I have updated the app delegate with the following code :

self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);

The interface etc, is generated directly via ViewController code and not using Interface Builder or StoryBuilder.

Please advice..

UPDATE:

Using the following in all viewcontroller

UIImage *stretchImage=[UIImage imageNamed:kNavigationBg]; stretchImage=[stretchImage stretchableImageWithLeftCapWidth:1 topCapHeight:0]; [self.navigationController.navigationBar setBackgroundImage:stretchImage forBarMetrics:UIBarMetricsDefault];

回答1:

Set View controller-based status bar appearance to NO in ur plist.



回答2:

Select each ViewController in your Storyboard and, tick both options "Under top bars" , "Under bottm bars"

Programmatically ,

self.edgesForExtendedLayout = UIRectEdgeNone;


回答3:

You should add

if(IS_IOS7)
{
    self.edgesForExtendedLayout=UIRectEdgeNone;
}