0

I use UITextField and I want padding top. So... How to in UITextField text padding top?

Sorry for my English:/

enter image description here

Vykintas
  • 401
  • 1
  • 8
  • 23
  • Possible duplicate of [Text inset for UITextField?](https://stackoverflow.com/questions/2694411/text-inset-for-uitextfield) – alanhchoi May 28 '17 at 12:43

1 Answers1

1

If I am not wrong then you want translate your text inside the textfield by y. UITextField have property know as sublayerTransform which can be used to translate the text. For example, to give a text view translate x by 10 and y by 10 you would use this code:

let titleTextField = UITextField(frame: CGRectZero)
titleTextField.layer.sublayerTransform = 
let shiftTextByX = 10
let shiftTextByY = 10
titleTextField.layer.sublayerTransform  CATransform3DMakeTranslation(shiftTextByX, shiftTextByY, 0)
Vivek Parihar
  • 2,318
  • 18
  • 18