[英]UITextField font size changes when start or stop entering the characters
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. 我有使用XIB创建的UITextfield没有为该字段编程。
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, Okie,
I guess I have found the solution. 我想我找到了解决方案。
Create a IBOutlet for the UITextfield. 为UITextfield创建一个IBOutlet。
in textFieldDidEndEditing and textFieldShouldReturn call below lines 在textFieldDidEndEditing和textFieldShouldReturn中调用以下行
[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 将字体设置为nil是关键,没有它将不设置新字体
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.