I have a custom font in a UITextField, and I\'ve noticed that when it\'s accessed (when the keyboard appears), the text shifts down by a very small amount -- maybe
Works for all font sizes and does not cause de-alignment with clearButton
.
Subclass UITextField
and override these as follows:
- (CGRect)placeholderRectForBounds:(CGRect)bounds
{
return CGRectOffset( bounds, 0, 4 );
}
- (CGRect)editingRectForBounds:(CGRect)bounds
{
return CGRectOffset( bounds, 0, 2);
}
- (CGRect)textRectForBounds:(CGRect)bounds
{
return CGRectOffset( bounds , 0 , 4 );
}