iOS 7 Status Bar Collides With NavigationBar using ViewController

▼魔方 西西 提交于 2019-12-11 19:14:58

问题


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;
}


来源:https://stackoverflow.com/questions/23150411/ios-7-status-bar-collides-with-navigationbar-using-viewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!