Vinayaka Karjigi
Vinayaka Karjigi

Reputation: 1090

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.

Upvotes: 6

Views: 2497

Answers (1)

Vinayaka Karjigi
Vinayaka Karjigi

Reputation: 1090

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

Upvotes: 12

Related Questions