When self.navigationController.navigationBar.translucent = NO, a white space occur under the navigation bar, like this:

How can I remove it?
// From above example
(void)loadUI
{
[self.countriesButton setBackgroundColor:[UIColor colorWithRed:(243/255.0) green:(178/255.0) blue:(128/255.0) alpha:1]];
[self.countriesButton.layer setCornerRadius:10];
[self.countriesButton setClipsToBounds:YES];
/// set attributes for Navigation Bar
self.navigationItem.title = @"Welcome"; // Title of Navigation Bar
self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:(243/255.0) green:(178/255.0) blue:(128/255.0) alpha:1];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
self.navigationController.navigationBar.translucent = NO;
}
Im gonna chime in how i solved this one since it was easy and worked well.
In your storyboard select the view controller that is getting the whitespace under the opaque navbar.
Then go to 'Attributes Inspector' -> 'View Controller' -> 'Extend Edges' -> Check the box that says 'Under Opaque Bars'
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