Reputation: 9404
I need to apply a specific format for navigation title
I write this code
// color
UIColor *titlecolor = [self getUIColorObjectFromHexString:@"#5C8EB3" alpha:1.0];
[self.navigationController.navigationBar setTitleTextAttributes:
@{NSForegroundColorAttributeName:titlecolor}];
// font face
UIFont *font=[UIFont fontWithName:@"NotoKufiArabic-Regular" size:16.0f];
[self.navigationController.navigationBar setTitleTextAttributes:
@{NSFontAttributeName:font}];
there is no problem with color, the problem is with font can anyone please tell me what is the problem ?
Upvotes: 0
Views: 51
Reputation: 3487
You don't say what you're seeing, only that the setting the font doesn't work. I'm going to make a guess that the font is the problem (it might not be). But to hazard a guess, try these to see if we can narrow the problem down a bit:
In your plist have you included the fonts under UIAppFonts aka Fonts provided by application?
Also, have you made sure that the correct targets are selected for your custom font?
Run this:
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSLog(@"Fonts: %@", [UIFont familyNames]);
are your fonts listed?
Check the Font Book application on your mac, search for the font and find its correct name (called PostScript name). Use exactly this name to refer to the font.
Is the font included in the bundle resources? (Under Build Phases -> Copy Bundle Resources.)
When you added the fonts to your project, did you select 'Copy items if needed'?
Are you doing this in a Launch Screens storyboard? They can't use custom fonts.
Upvotes: 2