UITextField changes font while editing

前端 未结 4 1558
滥情空心
滥情空心 2021-01-05 05:31

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 as

相关标签:
4条回答
  • 2021-01-05 05:59

    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

    0 讨论(0)
  • 2021-01-05 05:59

    I have found that when I'm setting the UILabel appearance anywhere in the code:

    [[UILabel appearance] setFont:MYFONT];
    

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

    Hope this helps

    0 讨论(0)
  • 2021-01-05 06:03

    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
    
    }
    
    0 讨论(0)
  • 2021-01-05 06:05

    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.

    0 讨论(0)
提交回复
热议问题