本文介绍了UITextField在编辑时更改字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到同样的问题,因为这里 UITextField的自定义字体改变在编辑模式下
,并且可以真正解决方案。

我有4个UITextFields,我在ViewDidLoad中分配自定义字体。
这个工作,他们看起来不错,但是当点击一个字段来编辑文本的字体变回默认文本,当resignedfirstresponder自定义字体回来。 p $ p> - (void)viewDidLoad
{
[super viewDidLoad];
{

UIFont * twoDumb = [UIFont fontWithName:@Dumbsize:20.f];

lbl1.font = twoDumb;
bringForward.font = twoDumb;
lbl2.font = [UIFont fontWithName:@Dumbsize:24.f];
amountTextfield.font = twoDumb;
lbl3.font = twoDumb;

如果我使用系统字体,那么文本字段就像它应该那样工作,所以必须有一些这个字体文件可能吗?



我怀疑它正在改变的字体是由于在Xib文件中设置字体


$ b


I am suffering the same problem as here UITextField's custom font changes while in edit modeand 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?

解决方案

The 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.

这篇关于UITextField在编辑时更改字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 13:05
查看更多