Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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.

like image 534
Vinayaka Karjigi Avatar asked Oct 01 '13 10:10

Vinayaka Karjigi


Video Answer


1 Answers

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

like image 172
Vinayaka Karjigi Avatar answered Oct 16 '22 14:10

Vinayaka Karjigi