1

I have a view controller with a special font and a shadow image on it's navigation bar. However, when I segue to a different view controller, the new view controller mimics the navigation bar qualities of the view controller it was segued from. How do I get rid of this quality?

self.navigationController?.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "AmericanTypewriter-Bold", size: 24.0)!, NSForegroundColorAttributeName: UIColor.white] self.navigationController?.navigationBar.isTranslucent = false self.navigationController?.navigationBar.shadowImage = UIImage(named: "shadow") 

1 Answer 1

3

To have the same style of navigation bar in all view controllers you should specify the navigation bar style in AppDelegate. In your case in didFinishLaunchingWithOptions method add the following lines:

UINavigationBar.appearance().titleTextAttributes = [ NSFontAttributeName: UIFont(name: "AmericanTypewriter-Bold", size: 24.0)!, NSForegroundColorAttributeName: UIColor.white] UINavigationBar.appearance().isTranslucent = false UINavigationBar.appearance().shadowImage = UIImage(named: "shadow") 

Now in all view controllers you will have the same navigation bar.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.