UITextField font size changes when starting or stopping character input

I saw a lot of threads, but did not find a specific solution to this problem.

I have a UITextfield created using XIB, nothing was done programmatically for this field.

As soon as I start typing, the font of the text field changes, and as soon as I get out of focus, and when the keyboard disappears, the font size decreases.

how to disable it. I do not want the font to change when the focus moves out of the text box.

+6
source share
1 answer

Okie

I guess I found a solution.

Create an IBOutlet for the UIText field.

in textFieldDidEndEditing and textFieldShouldReturn call under the lines

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

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

+12
source

Source: https://habr.com/ru/post/955012/


All Articles