我正在尝试更改状态栏中的文本颜色以及导航中的所有内容。
我正在使用这段代码:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
此代码确实有效,但我收到警告:
Implicit conversion from enumeration type 'enum UIStatusBar' to different enumeration type 'UIBarStyle' (aka) 'enum UIBarStyle').
谁能告诉我我做错了什么?
彼得
最佳答案
要更新状态栏颜色,你可以这样做
[self setNeedsStatusBarAppearanceUpdate];
你应该有这个定义
-(UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleDefault;
}
为导航栏文字颜色
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
[self.navigationItem.title = @"Test"];
关于ios - 在 objective-c 中更改导航状态栏文本颜色时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19554591/