开始或停止输入字符时,UITextField字体大小会发生变化 [英] UITextField font size changes when start or stop entering the characters

查看:212
本文介绍了开始或停止输入字符时,UITextField字体大小会发生变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了很多线程,但没有找到任何具体的解决方案,这个问题。

我有使用XIB创建的UITextfield没有做任何编程该字段。 p>

只要我开始输入,文本字段的字体会发生变化,一旦我将焦点移出焦点,键盘消失,字体大小就会减少。 b

如何禁用此功能。当焦点移出文本框时,我不希望字体发生变化。

Okie,

我想我找到了解决方案。

为UITextfield创建一个IBOutlet。

<在textFieldDidEndEditing和textFieldShouldReturn调用下面的行

  [self.yourTextField setFont:nil]; 
[self.yourTextField setFont:你的字体名称和大小];

将字体设置为nil是键,否则将不会设置新的字体


I have seen many threads but not finding any concrete solution for this problem.

I have UITextfield created using XIB nothing has been done programmaticaly for that field.

As soon as i start typing, the font of textfield changes and once i move the focus out of it and as keyboard disappears the font size reduces.

how to disable this. I dont want the font to change when focus is moved out of textfield.

解决方案

Okie,

I guess I have found the solution.

Create a IBOutlet for the UITextfield.

in textFieldDidEndEditing and textFieldShouldReturn call below lines

[self.yourTextField setFont:nil];
[self.yourTextField setFont:"your font name and size"];

setting the font to nil is key without which new font will not be set

这篇关于开始或停止输入字符时,UITextField字体大小会发生变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆