nca
nca

Reputation: 445

Navigation bar tint color change

I have a navigation bar whose tint color is set, but when I navigate to other screen it looks bit different like in lighter than previous one..any idea why it is happening..how to fix this

Upvotes: 3

Views: 6792

Answers (4)

何华俊
何华俊

Reputation: 11

[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor redColor]}];

Upvotes: 0

Berlin
Berlin

Reputation: 2201

In Story Board select navigation Bar and change bar tint color

in image display with red mark.

enter image description here

Upvotes: 1

Prashant
Prashant

Reputation: 336

If you are using the same Navigation controller for all the ViewControllers in your project, then you need to set the tint colour in AppDelegate.

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        UINavigationBar.appearance().barTintColor = colorToSet 
// colorToSet is an object of UIColor 
        return true
    }

Upvotes: 0

Sudipto Roy
Sudipto Roy

Reputation: 6795

Add this code to your rootViewController

 override func viewWillAppear(_ animated: Bool) {
        navigationController?.navigationBar.barStyle = UIBarStyle.default
        navigationController?.navigationBar.tintColor = UIColor.black
    }

Upvotes: 1

Related Questions