i want to have white text in navigation bar but i still have it black whenever i have code for white font.
let titleDict: NSDictionary = [NSForegroundColorAttributeName: UIColor.whiteColor()]
self.navigationController?.navigationBar.titleTextAttributes = titleDict
self.navigationController?.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "HelveticaNeue-Light", size: 20)]
I tried
self.navigationController?.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIColor.whiteColor()]
but didnt worked
Seems that you are overwriting the changes each time you set titleTextAttributes
. Try to set all attributes at the same time:
self.navigationController?.navigationBar.titleTextAttributes = [
NSFontAttributeName: UIFont(name: "HelveticaNeue-Light", size: 20),
NSForegroundColorAttributeName: UIColor.whiteColor()
]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.