Answer the question
In order to leave comments, you need to log in
How to limit text input to UITextField dimensions?
Good evening! Can you please tell me how to limit text input to the size of UITextField?
Answer the question
In order to leave comments, you need to log in
You can define text sizes with
[textField.text sizeWithAttributes: @{NSFontAttributeName:tf.font}].width;
Override the delegate method to change the text in the textfield. Next, using the method described above, determine the size of the entered text. If the dimensions are greater than frame TexField'a return false in the delegate method.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question