iOS 6看......
我希望在iOS 7中显示状态栏,如
看到这个
但我的实际输出(重叠)
我试过以下逻辑
open your info.plist and set "View controller-based status bar appearance" = NO
它不能在我的代码中工作,,,
答案 0 :(得分:17)
你必须做两件事。首先是打开info.plist
并设置"View controller-based status bar appearance" = NO
第二个是将这些行添加到application:didFinishLaunchingWithOptions
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
{
self.window.clipsToBounds = YES;
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackOpaque];
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if(orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
{
self.window.frame = CGRectMake(20, 0,self.window.frame.size.width-20,self.window.frame.size.height);
self.window.bounds = CGRectMake(20, 0, self.window.frame.size.width, self.window.frame.size.height);
} else
{
self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height);
}
}
答案 1 :(得分:9)
阅读这篇文章:http://www.appcoda.com/customize-navigation-status-bar-ios-7/
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
[[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x067AB5)];
答案 2 :(得分:0)
将帧移动20个像素。您可以尝试在ViewWillappear或DidAppear
中编写此代码CGRect frame = self.view.frame;
frame.origin.y = 20;
if (self.view.frame.size.height == 1024 || self.view.frame.size.height == 768)
{
frame.size.height -= 20;
}
self.view.frame = frame;
现在在applicationDidFinishLaunching中将窗口的背景颜色设置为黑色,并将状态栏字体设置为白色(StatusBarContentLight)
记住我的建议不是完美的解决方案,而是一个可以很好地解决的修复方法。当应用更改其方向时,也使用相同的代码(ShouldAutorotate)