0
votes

My init ViewController will show status bar tint color with white color.

I need click the AlertertAction, presentViewController my UIDocumentPickerViewController status bar tint color will changed the the black color.

 ...
   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

 -(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.

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.

1
When you hit cancel does you viewWillAppear method is being called?3stud1ant3
yes , view will appear method is called. And it very strange, I set "[UINavigationBar appearance].tintColor = [UIColor blackColor];" black color, show the cloudPicker status bar tint color still white color, not black color immediately.dickfala
please try barTintColor instead of tintColor and see what is the behaviour?3stud1ant3
[UINavigationBar appearance].barTintColor = [UIColor blackColor]; [self presentViewController:cloudPicker animated:YES completion:nil]; The UIDocumentPickerViewController not changed color.dickfala
Init viewcontroller changed white color, But show the document picker view controller not change black color, still white color.dickfala

1 Answers

-1
votes

Have you tried changing UINavigationBar's titleTextAttributes?

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