项目遇见第一个问题:
ios6下系统默认状态栏所占的20px,在ios7下不存在,导致设置背景图产生布局错误
解决:
ios7中我们通过ViewController重载方法返回枚举值的方法来控制状态栏的隐藏和样式。
1,在XXX-info.plist文件中设置键值对 :UIViewControllerBasedStatusBarAppearance 设置值为YES;
2,在UINavigationController中写入以下方法
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
- (BOOL)prefersStatusBarHidden
{
return NO;
}
3 最终想要实现ios7之前的黑色状态栏还是需要为当前的navigationbar设置图片
[self.navigationBar setBackgroundImage:imgHeaderBg forBarMetrics: UIBarMetricsDefault];
OK