0

Is there any way to add padding to a UITextField? I have seen similar questions, but the solutions didn't work for me. I am trying to force any text entered in the field to appear 44 pixels from the left. I have tried creating an empty view and setting it as the text field's leftView. After setting a background color for that leftView, I see that it appears but it doesn't force the cursor over.

Is this even possible in Swift? Thank you so much in advance!

mhunt2015
  • 151
  • 3
  • 11
  • Could you achieve the desired effect by putting the text field inside a view with the same background colour and pinning the text field 44px from the left side of the view? – Westside May 19 '16 at 15:39
  • Thank you so much for leading me in the right direction. I have found that simply doing this works: myTextField.layer.sublayerTransform = CATransform3DMakeTranslation(44,0,0) in viewDidLoad() – mhunt2015 May 19 '16 at 15:46

0 Answers0