An old client asked me to make some minor updates to his app. Compiling for iOS 15 and above, the bottom toolbar is now black (after momentarily flashing the original intended color). I had the same problem with the navigation bar, and fixed that with the below code, but the bottom toolbar is still problematic. (This app was written a long time ago so is in Objective C, but I would be grateful for answers in either Objective C or Swift).
UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
[appearance configureWithOpaqueBackground];
appearance.backgroundColor = [CommonColors colorWithHexString:@"174594"];
appearance.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
self.navigationController.navigationBar.standardAppearance = appearance;
self.navigationController.navigationBar.scrollEdgeAppearance = self.navigationController.navigationBar.standardAppearance;
I thought to do something similar using UIToolbarAppearance, but couldn't make it work. This is what I tried:
UIToolbarAppearance *toolbarAppearance = [UIToolbarAppearance new];
[toolbarAppearance configureWithOpaqueBackground];
toolbarAppearance.backgroundColor = [CommonColors colorWithHexString:@"174594"];
toolbarAppearance.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
self.navigationController.toolbar.standardAppearance = toolbarAppearance;
Thanks for any help.
In accordance with Matt's comment above, I set all four appearances for the toolbar:
UIToolbarAppearance *toolbarAppearance = [UIToolbarAppearance new];
[toolbarAppearance configureWithOpaqueBackground];
toolbarAppearance.backgroundColor = [CommonColors colorWithHexString:@"F7F7F7"];
self.navigationController.toolbar.standardAppearance = toolbarAppearance;
self.navigationController.toolbar.scrollEdgeAppearance = toolbarAppearance;
self.navigationController.toolbar.compactScrollEdgeAppearance = toolbarAppearance;
self.navigationController.toolbar.compactAppearance = toolbarAppearance;
(CommonColors is my own custom class for converting colors, but any of the standard ways of getting a UIColor could be used).