Reputation: 1904
I'd like to center (horizontally align) the text in a text field (including the placeholder text) although there is a leftView added to the UITextField
.
When adding a left view to a UITextField
, the text is not centered anymore.
How can I fix this? I user should not be able to override the left view when entering text in the TextField.
This is an example:
I thought about adding the same view as the right view and set its alpha value to zero, but I don't think that would be an elegant approach.
Upvotes: 0
Views: 240
Reputation: 100541
I would prefer to create it custom like this without leftView
UIView
- 0 - UIImageView - 10 - UITexfield - 10
- 0 - separator (UIView) - height(1)- 0
Then copy paste that view for password
Upvotes: 1