簡體   English   中英

iOS更改文檔選擇器狀態欄顏色不變

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

我的初始化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),統計顏色仍為whiteColor(位於UIDocumentPickerViewController上),然后單擊選擇器取消,我的視圖控制器將顏色更改為黑色,而不是白色。

有沒有人知道如何在我單擊警報操作時更改顏色,選擇狀態欄的顏色更改為(更改為黑色),然后關閉選擇器,我的視圖控制器在狀態欄的顏色仍為白色。

非常感謝你。

您是否嘗試過更改UINavigationBar的titleTextAttributes?

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM