【发布时间】:2017-09-11 02:51:09
【问题描述】:
我的初始化 ViewController 将显示状态栏的颜色为白色。
我需要点击 AlertertAction,presentViewController 我的 UIDocumentPickerViewController 状态栏颜色会变成黑色。
...
cloudAction = [UIAlertAction
actionWithTitle:@"from cloud"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[UINavigationBar appearance].tintColor = [UIColor blackColor];
[self presentViewController:cloudPicker animated:YES completion:nil];
}];
...
而我的viewwillappear方法集
-(void) viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[UINavigationBar appearance].tintColor = [UIColor whiteColor];
}
这很奇怪。当我单击警报时,显示我的云选择器(UIDocumentPickerViewController),统计信息的颜色仍然是白色(在 UIDocumentPickerViewController 上),然后单击选择器取消,我的视图控制器更改为黑色,而不是白色。
有没有人知道当我单击警报操作时如何更改颜色,拾取统计栏色调颜色已更改(更改为黑色),并关闭拾取器,我的视图控制器在状态栏色调颜色处仍为白色。
非常感谢。
【问题讨论】:
-
当您点击
cancel时,您是否正在调用viewWillAppear方法? -
是的,视图会出现方法被调用。而且很奇怪,我设置了“[UINavigationBar外观].tintColor = [UIColor blackColor];”黑色,显示 cloudPicker 状态栏 tint color 还是白色,不是立即黑色。
-
请尝试
barTintColor而不是tintColor,看看会发生什么? -
[UINavigationBar 外观].barTintColor = [UIColor blackColor]; [自我presentViewController:cloudPicker动画:是完成:无]; UIDocumentPickerViewController 没有改变颜色。
-
初始化视图控制器改变了白色,但是显示文档选择器视图控制器没有改变黑色,仍然是白色。
标签: ios objective-c colors statusbar tint