Take the 2-minute tour ×

I am suffering the same problem as here UITextField's custom font changes while in edit mode and could really do with a solution.

I have 4 UITextFields that I assign custom fonts in ViewDidLoad. This works and they look great, however when clicking a field to edit the text the font changes back to default text and when resignedfirstresponder the custom font comes back.

- (void)viewDidLoad
    [super viewDidLoad];

        UIFont *twoDumb = [UIFont fontWithName:@"Dumb" size:20.f];

        lbl1.font = twoDumb;
        broughtForward.font = twoDumb;
        lbl2.font = [UIFont fontWithName:@"Dumb" size:24.f];
        amountTextfield.font = twoDumb;
        lbl3.font = twoDumb;

If I use system fonts, then the text field works as it should, so there must be something to do with this font file maybe?

share|improve this question
what is your custom font name ???? –  Inder Kumar Rathore Feb 20 '12 at 10:24
font is 2Dumb.ttf I'm just trying to change it but it seems to be cached somewhere as changing the name still loads the old file. Maybe i'll try a reboot. –  Darren Feb 20 '12 at 10:41
I've deleted the font from Xcode, renamed it to just "Dumb.ttf" and put it back in Xcode. Changed my code font= to say just Dumb and renamed it in the plist, however it won't load the font. Any lines of code still saying 2Dumb WILL load the font. Very frustrating. –  Darren Feb 20 '12 at 10:53
put some code in you question... –  Inder Kumar Rathore Feb 20 '12 at 10:57
There's not really much code to see, but i've added it. –  Darren Feb 20 '12 at 10:59

4 Answers 4

up vote 2 down vote accepted

enter image description hereThe lable (lbl1,lbl2,lbl3) which you have used are custom or is it set from xib file?

I doubt the font it is changing is due to font set in Xib file.

enter image description here

share|improve this answer
The textfields (lbl1, lbl2 etc..) are added in storyboard then the font changed in ViewDidLoad. –  Darren Feb 27 '12 at 11:54
Change the font of that (lbl1, lbl2 etc..) in storyboard of whatever type you want. It also happened with me before. I have changed the font name in xib files of type wht i want. And it worked... –  Rupesh Feb 27 '12 at 11:59
But the custom font doesn't appear in the interface builder. –  Darren Feb 27 '12 at 12:00
then download the font,and add it to your xib files. –  Rupesh Feb 27 '12 at 12:04
I've awarded you the bounty for the live help you gave me. Although a solution was never found. I have filed a bug report with Apple. Thanks –  Darren Feb 28 '12 at 12:22

I have downloaded that font and tried it in an iPhone app. I also downloaded some other fonts from the internet and tried them as well. I also tried some Mac fonts such as Chalkduster. I also tried 3Dumb. The results every font I tried EXCEPT 2Dumb and 3Dumb worked. Solution: Use another font.

share|improve this answer
Thank you for taking the time to test. I'll have to try and find a similar font. I wonder what could possibly be different in the font to make it not work. –  Darren Feb 23 '12 at 22:35
Perhaps just try any other font. I tested with www.WebpagePublicity.com/free-fonts/a/Aliens.ttf and it worked as expected If it doesn't for you, then you might have some other issue. –  dbrajkovic Feb 23 '12 at 22:40
Yes it works fine with other fonts. –  Darren Feb 24 '12 at 9:45

I have found that when I am setting the label appearance anywhere in the code:

[[UILabel appearance] setFont:MYFONT];

Changing UITextField font only applies to editing text, and not to the text showed in Textfield when user is not editing it.

Hope this helps

share|improve this answer

You can set the font again when editing, the font will be the same when editing.

- (void)textFieldDidBeginEditing:(UITextField *)textField {
    textField.font = customizedFont; //The font you want to use no matter editing/no editing

share|improve this answer

Your Answer


