9

I have the following problem - I want to change the UITextField font to a custom one. I am using this line of code:

textField.font = [UIFont fontWithName:@"fontname.ttf" size:20];

I want to use this font: Neurm.ttf Can you please tell me what is wrong or just try it out and tell me is it working?

scourGINHO
  • 699
  • 2
  • 12
  • 31

3 Answers3

14

You doing wrong Because no need to set extension (fontname.ttf) in your string.

textField.font = [UIFont fontWithName:@"NEURM TTF" size:20];

and check following links how to use custom font in ios.

1.How to use custom font in iOS Apps?

2.iPhone Development: how to use custom fonts?

Community
  • 1
  • 1
Dharmbir Singh
  • 17,485
  • 5
  • 50
  • 66
1

Its possible you may have not gone through some necessary steps to embed a custom font in your app.

Check;

and see if you missed anything.

Community
  • 1
  • 1
Madhu
  • 2,429
  • 16
  • 31
  • Nope, I am doing everything right. I tried the way you told me but still no result. I think its because of the specific font, can you please try it and tell me what is the result? – scourGINHO May 16 '13 at 09:27
  • 1
    Did you try setting 'NeuropolMedium' as the font name? i.e. [UIFont fontWithName:@"NeuropolMedium" size:20] – Madhu May 16 '13 at 10:17
1

here

someTf.font = [UIFont fontWithName:@"AlexBrush-Regular" size:20];

This is working correctly no need to give .ttf ext