I am trying to set the color of my navigation bar. I have added my font in the plist file and added it as a resource, and I can select it as font in the storyboard when using a UILabel. So the font seems to be there.
I have tried this in the app delegate:
NSDictionary *textTitleOptions = [NSDictionary dictionaryWithObjectsAndKeys:myLightBrownColor, NSForegroundColorAttributeName,[UIFont fontWithName:@"Pacifico" size:17.0f], NSFontAttributeName,
myShadow, NSShadowAttributeName, nil];
[navigationBarAppearance setTitleTextAttributes:textTitleOptions];
And this in the view controller directly:
NSShadow *myShadow = [MRStyleController getMyShadow];
NSDictionary *textTitleOptions = [NSDictionary dictionaryWithObjectsAndKeys:[MRStyleController getLightBrownColor], NSForegroundColorAttributeName,[UIFont fontWithName:@"Pacifico" size:17.0f], NSFontAttributeName,
myShadow, NSShadowAttributeName, nil];
self.navigationController.navigationBar.titleTextAttributes = textTitleOptions;
However, none of this did change the apps navigation bar title font and color.
Any suggestions?
EDIT: what correctly works is:
UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
[navigationBarAppearance setBarTintColor:myBrownColor];
NSDictionary *textTitleOptions = [NSDictionary dictionaryWithObjectsAndKeys:myLightBrownColor, NSForegroundColorAttributeName,
myShadow, NSShadowAttributeName,
[UIFont fontWithName:@"AmericanTypewriter" size:16.0], NSFontAttributeName, nil];
[navigationBarAppearance setTitleTextAttributes:textTitleOptions];
This will change the font to "American TypeWriter".
But I have a custom font named "Pacifico", which is in my "Supporting Files" folder, as "Pacifico.ttf", and listed in my info.plist as "Fonts provided by application", but the font isn't changing, so somehow the custom font is not correctly referenced?