Craig Grummitt
Craig Grummitt

Reputation: 2995

Customizing UINavigationBar's barTintColor and title text color in Xcode 11.4

Customizing the UINavigationBar in Interface Builder (specifically customizing both the bar's barTintColor and the title text color) seems to have become very buggy in iOS 13.

Here is a video fo me trying to do it in Interface Builder: https://youtu.be/fQPjKv0yrk8

Long story short, if you set both the navigation bar's barTintColor and title text color (large or regular titles), the title color is ignored.

Using the superclass UIView's backgroundColor instead seems to be buggy too. Is there a definitive answer of how to approach customizing navigation bars? Or have they just become buggy, and hacky solutions are necessary?

UPDATE: This seems to have been a problem in Xcode 11.4 and is said to have been resolved in Xcode 11.4.1:

Quote from Xcode 11.4.1 Release Notes:

Interface Builder Fixed an issue that caused some UINavigationBar appearance properties set in storyboard and XIB documents to be ignored when building with Xcode 11.4. (60883063) (FB7639654)

HOWEVER, it doesn't seem to have been resolved for me, and the problem I described is still happening for me.

Upvotes: 0

Views: 168

Answers (1)

M Ohamed Zead
M Ohamed Zead

Reputation: 197

works fine with me Xcode Version 11.3 (11C29) seems like a bug in xcode , try this in code in viewDidLoad()

 navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.red]
 navigationController?.navigationBar.barTintColor  = .yellow

and in case of large title replace titleTextAttributes with largeTitleTextAttributes

Upvotes: 1

Related Questions