0

Hi I am using below code to use custom font style for label text. I've installed it and work fine but the problem is that the size of text does not change. I've tried more times with different sizes. I don't know what should do

self.saveButton_label.text = NSLocalizedString(@"Saved", nil);
self.saveButton_label.font = [UIFont fontWithName:@"Helvetica Neue LT Pro" size: 13.0];
Black Frog
  • 11,595
  • 1
  • 35
  • 66
  • please try this to see if the font is loaded http://stackoverflow.com/questions/13798002/setting-size-to-custom-ios-font-doesnt-work – Bogus Apr 11 '14 at 11:43
  • You can try: `[self.saveButton_label setFont:[UIFont fontWithName:@"Helvetica Neue LT Pro" size: 13.0]];` – pankaj asudani Apr 11 '14 at 11:46
  • Put a breakpoint just after this code and read `(po self.saveButton_label.font)` the value of the font. – bsarr007 Apr 11 '14 at 11:52
  • I think the font is not loading properly, you may think you are seeing the correct font, but you might simply be seeing the default Helvetica Neue. Try creating the font on a separate line and logging that result out, I believe you will see that it is nil – Henri Normak Apr 11 '14 at 13:04

2 Answers2

0

Try this code, In your code you are missing "-" with font name.

    self.saveButton_label.text = @"Saved";

     [self.saveButton_label setFont:[UIFont fontWithName:@"Helvetica-Neue-LT-Pro size:13.0f]];

also you can use below fonts.

    HelveticaNeueLTPro-MdCn
    HelveticaNeueLTPro-BdCn

Hope it will work for you.

Ram S
  • 793
  • 12
  • 21
0

I believe the issue lies with one of the steps you need to take when adding a custom font to your project, you probably are not noticing the difference because Helvetica Neue is also the default font, which I believe is used if you were to assign nil to UILabel as the font.

I suggest following this guide, I've used it as a checklist myself when using custom fonts and it has worked, especially take not of the naming, the name you have to use in code might not be the one you see in FontBook or when using Preview on the font.

Henri Normak
  • 4,695
  • 2
  • 23
  • 33