5

I have a UITextField with a background image set. The background image consists of a border with an icon on the left side. I'd like to move the cursor so the editing starts after the icon appears. How would I accomplish this in swift?

edit: Would it be easier have a custom border as an uimageview and the textfield placed over it and attached to it? If so what would be the best way to do this?

1 Answers1

15

if you want left padding in TextField just use below code ,

youTextFiled.layer.sublayerTransform = CATransform3DMakeTranslation(5, 0, 0);

The amount of left padding you can change by changing the value of at first argument .

Dhiru
  • 3,040
  • 3
  • 25
  • 69