Reputation: 4665
I wanted to set a consistent title colors for all my navigation bars:
NSDictionary *titleAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor],
NSFontAttributeName: MY_FONT_HERE};
[[UINavigationBar appearance] setTitleTextAttributes:titleAttributes];
This piece of code work in iOS6 but CRASH in ios7.
The crash message is bizarre:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [__NSCFConstantString pointSize]: unrecognized selector sent to instance 0x107c34'
Upvotes: 1
Views: 3434
Reputation: 5417
I'm guessing that MY_FONT_HERE is a string value, when it should be a UIFont. Instead of passing in the string to the attributes, initialize the font with [UIFont fontWithName:MY_FONT_HERE]
.
Upvotes: 1