Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective C: How to change text color in navigation bar

I have changed my navigation bar color via the following code

navconFvc.navigationBar.tintColor = [UIColor colorWithHexString:@"faf6f5"];

The code worked but the text color also needs to be changed (see screenshot below). Also the refresh button logo on the right is affected as well

enter image description here

The same issue occurs if I navigate to another page in the stack

enter image description here

Question: How can I change the color of the

  • title text
  • Back button text and
  • right bar button icon color?

After I changed the background color of the navbar?

like image 610
Zhen Avatar asked Jul 24 '11 05:07

Zhen


People also ask

How do I change the navigation title text color?

Changing the text color The text color of the navigation bar can be changed using two inbuilt classes: navbar-light: This class will set the color of the text to dark. This is used when using a light background color. navbar-dark: This class will set the color of the text to light.

How do I change the color of my navigation?

In order to change the hub navigation bar color, we can go to site settings of hub site>Change the look>under the header section>Background> select a theme color to change the background color of your site header.


2 Answers

In iOS 7, just use:

self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};

Change [UIColor whiteColor] with whatever text color you want

like image 156
Erwan Avatar answered Oct 05 '22 12:10

Erwan


For the title here's the way:

iPhone Navigation Bar Title text color

And for the custom buttons here's the way:

adding buttons to ui navigation controller bottom bar

like image 34
Erre Efe Avatar answered Oct 05 '22 13:10

Erre Efe