Reputation: 2257
I have a view controller I am presenting modally. I want the status bar color to match the navigation bar color.
I have set UIViewControllerBasedStatusBarAppearance to YES because I don't want this change across the entire application.
I am setting self.navigationController.navigationBar.barTintColor but this is only changing the navigation bar color. The status bar remains a lighter color.
I have tried various combinations of setNeedsStatusBarAppearanceUpdate and preferredStatusBarStyle but none have any effect.
View controller is launched like so:
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:searchController];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:navigationController animated:YES completion:nil];
Upvotes: 0
Views: 897
Reputation: 26896
My steps are below, check where you go wrong:
Code is below:
- (IBAction)clickAction:(UIButton *)sender {
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ViewController2 *searchController = [sb instantiateViewControllerWithIdentifier:@"ViewController2"];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:searchController];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:navigationController animated:YES completion:nil];
}
Upvotes: 0