简体   繁体   English

iOS更改文档选择器状态栏颜色不变

[英]iOS change document picker status bar color not change

My init ViewController will show status bar tint color with white color. 我的初始化ViewController将用白色显示状态栏的颜色。

I need click the AlertertAction, presentViewController my UIDocumentPickerViewController status bar tint color will changed the the black color. 我需要单击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];
                }];
 ...

And My viewwillappear method set 而且我的viewwillappear方法集

 -(void) viewWillAppear:(BOOL)animated{
          [super viewWillAppear:animated];

              [UINavigationBar appearance].tintColor = [UIColor whiteColor];

      }

it is very strange. 这很奇怪。 When I click the alert, show my cloud picker(UIDocumentPickerViewController) , the stats tint color still whiteColor(on UIDocumentPickerViewController), then click the picker cancel, my view controller changed the black color, not the white color. 当我单击警报时,显示我的云选择器(UIDocumentPickerViewController),统计颜色仍为whiteColor(位于UIDocumentPickerViewController上),然后单击选择器取消,我的视图控制器将颜色更改为黑色,而不是白色。

Have anyone known how to change the color when I click the alert action , the pick stats bar tint color changed(changed to black color), and dismiss picker , my view controller still white color at status bar tint color. 有没有人知道如何在我单击警报操作时更改颜色,选择状态栏的颜色更改为(更改为黑色),然后关闭选择器,我的视图控制器在状态栏的颜色仍为白色。

thank you very much. 非常感谢你。

您是否尝试过更改UINavigationBar的titleTextAttributes?

UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.black]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM