I can't read the foreground color defined into the titleTextAttributes
property of a UINavigationBar
instance.
Here is my attempt:
label.textColor = navigationBarInstance.titleTextAttributes[NSForegroundColorAttributeName] as! UIColor
The titleTextAttributes is defined as var titleTextAttributes: [NSObject : AnyObject]?
so one of the error that I get is that I cannot subscript that properties using a String
(NSForegroundColorAttributesName
). The second error that I receive is that I cannot a sign a value of type UIColor
to a value of type UIColor!
.
I'm really confused! I just want to get the color of the navigationBar title and copy it into a label.textColor
property.