Search code examples
iphoneiosuitextfield

How to determine the length of the text in a UITextfield


I have a UITextField from which I'd like to determine the width of the entered text.

The bounds property has just the size of the Textfield but not of the text


Solution

  • CGFloat width =  [aTextField.text sizeWithFont:aTextField.font].width;