I'm trying to make the navigation bar become 100% transparent, so the UINavigationButtonItem elements are only visible, and the background (usually white) should show a background image.
I tried
HomeNavigationController *navBar = [[HomeNavigationController alloc] initWithRootViewController:self.myViewController]; [navBar.navigationBar setBarTintColor:[UIColor clearColor]]; [navBar.navigationBar setTranslucent:YES];
although they donβt work.
EDIT:
Using
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self.navigationController.navigationBar.shadowImage = [UIImage new]; self.navigationController.navigationBar.translucent = YES; self.navigationController.view.backgroundColor = [UIColor clearColor];
I see that it worked as expected, however the elements are now also invisible.
FINALEDIT: Ah, the code above works, just make sure that you do not apply any other appearance changes without testing first!
Code that actually does what is intended:
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
Alternatively, you can set a transparent image, but that makes sense. You will need the rest of the code shown in the original board if you don't want the line to represent the border.
source share