i need to set the UINavigationBars background color to the same value as my apps global tint color.
problem here is that now all buttons in my navigation bar are the same color as its background. i now could change all UIBarButtons text color to white but this would be totally unusable. using the UIAppearance API doesn't seem to be a better way. after setting the text color of UIBarButton items to white, f.e the back arrows of the back button in my UINavigationBar are still painted with the global tint color.
also if i change the global tint color to white i loose all the flexibility that the global tint color gives us (also my text indicator would now be white and would not be seen on a white background)
what i want:
what i get using blue as global tint color
what i get when using blue as global tint color and setting uibarbutton items text color to white (see the back button - it should be white as well)
what is the recommended way to fix this problem?
I recommend that you do this:
UINavigationBar *navigationBar = [UINavigationBar appearance];
navigationBar.tintColor = [UIColor whiteColor];
Place this code in the didFinishLaunchingWithOptions: method in the AppDelegate.
For clarification as you are obviously not very experienced with this:
barTintColor
is the property that would change the bar colour. tintColor
changes the colour of interactive objects (such as the UIBarButtonItem
s)
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