Is it possible to set padding inside a UITextField, if so how?
Asked
Active
Viewed 5,259 times
4
-
1See [Here](http://stackoverflow.com/questions/3727068/set-padding-for-uitextfield-with-uitextborderstylenone) – Luke Sep 28 '10 at 13:49
1 Answers
5
I was also wondering, here you are:
UIView paddingView = new UIView(new CGRect(0, 0, 5, 20));
YourTextField.LeftView = paddingView;
YourTextField.LeftViewMode = UITextFieldViewMode.Always;
You can modify padding size of course by changing values above.
Hope this will help.

Daniel Krzyczkowski
- 2,732
- 2
- 20
- 30
-
-
Worked great for me in a Custom renderor. I put it on the right as follows: UIView paddingView = new UIView(new CGRect(0, 0, 40, 20)); //paddingView.BackgroundColor = UIColor.Red; //for testing Control.RightView = paddingView; Control.RightViewMode = UITextFieldViewMode.Always; – Sabel Sep 14 '21 at 11:35