-
To facilitate the demonstration, I built a basic navigation bar with storyboard and got the Navgationbar in the code.
Uinavigationbar *bar = Self.navigationController.navigationBar;
[Bar Settintcolor:[uicolor Whitecolor];
Set navigation bar title color
| 123 |
[
Bar settitletextattributes:@{ nsforegroundcolorattributename: [Uicolor Whitecolor] }];
|
If you need to set the color of the return button, set the Tintcolor of bar
Set Uinavigationbar background picture
?
| 1 |
[bar setBackgroundImage:[UIImage imageNamed:@"bg.png"] forBarMetrics:UIBarMetricsDefault]; |
?
Set Uinavigationbar full transparency, set a picture here casually, it is important that the Barmetrics property determines the bar style
?
| 1 |
[bar setBackgroundImage:[UIImage imageNamed:@"bg.png"] forBarMetrics:UIBarMetricsCompact]; |
?
The navigation bar has no transparency when the content is not displayed under the navigation bar
?
| 1 |
self.extendedLayoutIncludesOpaqueBars = YES; |
?
Using storyboard requires setting in the controller
That's what happens when you're done, but the bar's tintcolor will be the color of the content below.
Also set in the scrolling view
The Automaticallyadjustsscrollviewinsets property controls whether scrolling content is displayed below bar.
iOS Settings Uinavigationbar style