Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextField: textRectForBounds: Vs. editingRectForBounds:

What's the difference between a UITextField's rectangle for its text vs. editable text?

I just want to move where the text is displayed inside the text field. Should I just override both methods with the same exact implementation?

UITextField Class Reference

textRectForBounds:

Returns the drawing rectangle for the text field’s text.

editingRectForBounds:

Returns the rectangle in which editable text can be displayed.

like image 577
ma11hew28 Avatar asked Dec 16 '11 14:12

ma11hew28


1 Answers

textRectForBounds: lets you set the rectangle for the text when the text field is not being edited.

editingRectForBounds: lets you set the rectangle for the text when the text field is being edited.

So, yes, you should implement both with the same exact implementation unless you want the text to jump when you begin & end editing.

like image 58
ma11hew28 Avatar answered Oct 11 '22 17:10

ma11hew28