iOS 6 看起来...
同样我想在 iOS 7 中显示状态栏
看到这个
但我的实际输出(重叠)
我试过以下逻辑
open your info.plist and set "View controller-based status bar appearance" = NO
它在我的代码中不起作用,,,
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);
}
}
阅读这篇文章: 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)];
将框架向下移动 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)