天天看点

IOS7适配相关问题总结

1:适配ios7时使用edgesForExtendedLayout遇到的问题 代码是navigationBar+tabBar组成的

在viewDidLoad里加了如下代码,

if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)

{

      self.edgesForExtendedLayout = UIRectEdgeNone;

      self.extendedLayoutIncludesOpaqueBars = NO;  

      self.modalPresentationCapturesStatusBarAppearance = NO; 

      self.navigationController.navigationBar.barTintColor =[UIColor grayColor];

      self.tabBarController.tabBar.barTintColor =[UIColor grayColor];

}

加了之后UI显示正常了,即没有上移20的高度。

问题是,当运行程序,自动进入到tabBar对应的第一个页面时,navigationBar和tabBar会出现黑色的背景,一小会会消失,才变成自己设置的背景色。

如果注释掉上面代码,进入程序时不会出现黑色背景,但是里面的UI会上移20的高度... 解决方法: self.navigationController.navigationBar.translucent = NO;

        self.tabBarController.tabBar.translucent = NO;

http://www.vinqon.com/codeblog/?detail/11109   ios7 相关适配问题

http://blog.sina.com.cn/s/blog_a573f7990101g3dy.html

iOS