Text inset for UITextField?
I was able to do it through:
myTextField.layer.sublayerTransform = CATransform3DMakeTranslation(5, 0, 0);
Of course remember to import QuartzCore and also add the Framework to your project.
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:
// placeholder position
- (CGRect)textRectForBounds:(CGRect)bounds {
return CGRectInset(bounds, 10, 10);
}
// text position
- (CGRect)editingRectForBounds:(CGRect)bounds {
return CGRectInset(bounds, 10, 10);
}