-1

When i am presenting new view using push method then for a little time little portition of my navigation bar color changes due to it it shows dark blue at that portition and then get back to light color.

As shown in the image.

How should i fix this effect

navigation bar background color changes

Parv Bhasker
  • 1,773
  • 1
  • 20
  • 39

1 Answers1

0

you can set it in appdelegate

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    UINavigationBar.appearance().barTintColor = UIColor(red: 0, green: 0/255, blue: 205/255, alpha: 1)
    UINavigationBar.appearance().tintColor = UIColor.whiteColor()
    UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]

    return true
}

or Can set in viewcontroller

override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.navigationBar.barTintColor = UIColor.whiteColor()
self.navigationController?.navigationBar.tintColor = UIColor.blueColor()
self.navigationController!.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.blueColor()]

}

more detail and credit: Swift - iOS : Change the color of a Navigation Bar

Hope this help

McFly
  • 31
  • 5