iOS更改文档选择器状态栏颜色未更改
My init ViewController将以白色显示状态栏的淡色 我需要单击AlerterAction,presentViewController我的UIDocumentPickerViewController状态栏颜色将更改为黑色iOS更改文档选择器状态栏颜色未更改,ios,objective-c,colors,statusbar,tint,Ios,Objective C,Colors,Statusbar,Tint,My init ViewController将以白色显示状态栏的淡色 我需要单击AlerterAction,presentViewController我的UIDocumentPickerViewController状态栏颜色将更改为黑色 ... cloudAction = [UIAlertAction actionWithTitle:@"from cloud" style:UIAlertActionStyleDefault
...
cloudAction = [UIAlertAction
actionWithTitle:@"from cloud"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[UINavigationBar appearance].tintColor = [UIColor blackColor];
[self presentViewController:cloudPicker animated:YES completion:nil];
}];
...
并且我的ViewWillDisplay方法集
-(void) viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[UINavigationBar appearance].tintColor = [UIColor whiteColor];
}
这很奇怪。当我单击警报时,显示我的云选取器(UIDocumentPickerViewController),统计色仍为白色(在UIDocumentPickerViewController上),然后单击选取器取消,我的视图控制器更改为黑色,而不是白色
是否有人知道如何更改颜色当我单击“警报”操作时,“拾取统计信息栏”的“染色颜色”已更改(更改为黑色),并且“取消拾取”,我的视图控制器在状态栏“染色颜色”处仍为白色
非常感谢。您是否尝试过更改UINavigationBar的titleTextAttributes
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.black]
当您点击
cancel
时,是否调用了viewwillbeen
方法?是,调用了方法后,视图将显示。非常奇怪的是,我设置了“[UINavigationBar外观]。tintColor=[UIColor blackColor];”黑色,显示cloudPicker状态栏tint color仍然是白色,而不是立即显示黑色。请尝试barTintColor
而不是tintColor
,然后查看行为是什么?[UINavigationBar外观]。barTintColor=[UIColor blackColor];[self-presentViewController:cloudPicker动画:是完成:无];UIDocumentPickerViewController未更改颜色。Init viewcontroller更改了白色,但显示文档选择器视图控制器未更改黑色,仍为白色。