I am trying to set a solid color for the navigation bar but it always appears translucent.
None of SO answers I tried seem to work.
I have tried:
In the App Delegate:
[[UINavigationBar appearance] setBackgroundColor:[UIColor colorWithRed:89/255.0 green:196/255.0 blue:197/255.0 alpha:1.0f]];
In my main TableviewController:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:89/255.0 green:196/255.0 blue:197/255.0 alpha:1.0f];
self.navigationController.navigationBar.translucent = NO;
}
I have also unchecked the Translucent
option and checked the Opaque
option in the attribute inspector.
Following is an image of what I am trying to achieve:
How do I make the navigation bar opaque with a solid background color?
Thanks.
Go to attribute inspector of for Navigation bar and remove check mark from translucent.
navigationController. navigationBar. barTintColor = UIColor. newBlueColor() and of course this just changes the colour of the navigation bar of the view controller that the code is within.
Go to attribute inspector of for Navigation bar and remove check mark from translucent.
Please find in image.
I was also trying to figure it how to make Navigation bar background a solid color. I was trying to change background color from Storyboard - Attribute inspector but that was wrong option.
The Bar Tint color in the attribute inspector changes the background color of navigation controller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With