iPhone how to: center and horizontal align the contents of a UITextField
August 7, 2009 . Posted in objective c.
It’s as simple as:
1 2 | theTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; theTextField.textAlignment = UITextAlignmentCenter; |
Basically this will ensure that no matter how tall your text field is the actual text will be centered both vertically and horizontally.
Cheers…
Tagged: how to, iPhone
Post a comment