0

I am trying to set custom font and color (white) for font in my app's navigation bar title. Instead of white I get gray text color.

Here is the code I'm using to set custom font:

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 30)];
label.textAlignment = UITextAlignmentCenter;
label.adjustsFontSizeToFitWidth = NO;
label.minimumFontSize = 10.0;
[label setFont:[UIFont fontWithName:@"HelveticaNeueLTCom-MdCn" size:24.0]];
[label setBackgroundColor:[UIColor clearColor]];
[label setTextColor:[UIColor whiteColor]];
[label setText:@"View title"];
[self.navigationItem setTitleView:label];

Same thing happened when I tried to set custom font color in UITableView sections.

I know about some problems with Helvetica Neue in iPhone apps development but the color of this font works well in other parts of my projects.

Am I missing something here?

syntagma
  • 23,346
  • 16
  • 78
  • 134

2 Answers2

0

Have you tried other .ttf fonts just to test if they work? I wonder if there is something wrong with the font file itself. try this directory and see if it works.

KDaker
  • 5,899
  • 5
  • 31
  • 44
0

The problem was that I've (deliberately) overriden default font for the whole application as described in this answer.

The solution was to remove this override (all the #import's and the remove .m file from the target, or just delete both of the class files.

Community
  • 1
  • 1
syntagma
  • 23,346
  • 16
  • 78
  • 134