Search code examples
iphoneiosfontsuitextfield

UITextField changes font while editing


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?


Solution

  • 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