<分区>
iOS 6 外观...
我想在 iOS 7 中以同样的方式显示状态栏
看到这个
但我的实际输出(重叠)
我试过以下逻辑
open your info.plist and set "View controller-based status bar appearance" = NO
它在我的代码中不起作用,,,
标签 ios objective-c ipad ios7
<分区>
iOS 6 外观...
我想在 iOS 7 中以同样的方式显示状态栏
看到这个
但我的实际输出(重叠)
我试过以下逻辑
open your info.plist and set "View controller-based status bar appearance" = NO
它在我的代码中不起作用,,,
最佳答案
你必须做两件事。首先是打开您的 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);
}
}
关于ios - 如何设置状态栏背景颜色 iOS 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19176784/