I would like to inset the text of a UITextField. Is this possible? Thanks.
A:
The best way is to inset your UITextField explicitly using the frame property.
Kenny
2010-04-22 21:03:18
+3
A:
In a class derived from UITextField, override at least this method:
- (CGRect)textRectForBounds:(CGRect)bounds;
It might be as simple as this if you have no additional content:
return CGRectInset( bounds , 10 , 10 );
UITextField provides several positioning methods you can override.
drawnonward
2010-04-22 21:04:34
A:
You can adjust the positioning of the text within a text field by making it a subclass of UITextField
and overriding the -textRectForBounds:
method.
Noah Witherspoon
2010-04-22 21:05:01
+1
A:
Overriding -textRectForBounds: will only change the inset of the placeholder text. To change the inset of the editable text, you need to also override -editingRectForBounds:.
azdev
2010-10-19 14:56:41