我的 AppDelegate 中有一个 UINavigationController 和一个具有 UITableView 的 RootViewController。启动时,状态栏将其颜色更改为导航栏的颜色。当我将导航栏涂成橙色时,状态栏是这样的:
我的导航栏似乎移到了顶部。导航 Controller 似乎无法识别状态栏。我该如何解决这个问题?
我的应用程序中只有一个 AppDelegate 和一个空的 RootViewController。我的 application:didFinishLaunchingWithOptions
是:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
RootViewController *rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
[navigationController.navigationBar setTintColor:[UIColor orangeColor]];
self.window.rootViewController = navigationController;
[self.window makeKeyAndVisible];
return YES;
我的 RootViewController IB 文件只有一个空 View 。
没有什么不寻常的。我对 iOS 非常有经验,这就是我每次都这样做的方式。我不知道这次有什么不同。
有人可以给我建议吗?谢谢
最佳答案
将您的状态栏样式设置为 UIStatusBarStyleBlackOpaque
你应该得到一个纯黑条。
为此,请使用 setStatusBarStyle:animated:
在您的应用程序实例上:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque
animated:NO];
关于iphone - iOS 状态栏会自行更改颜色以匹配导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15712567/