How to create UITextField with placeholder to the left and edited text to the right?

UITextField itself does not allow using its properties to put placeholder and edited text to different sides. Try to set it in the storyboard -> attributes inspector -> alignment. They are both to the left or both the right. There is no special alignment only for placeholder or only for the text.
To do this you should add a UILabel to the UITextField which is not editable and doesn't allow touches. Then set the text alignment on the UITextField to NSTextAlignmentRight.
First, set the text alignment to the right:
[textField setTextAlignment:NSTextAlignmentRight];
Fir the placeholder, you can add it as a subview, or use the leftView property:
[textField setLeftView:<your label here>];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With