ios - set the padding of a text field using swift in xcode -


how create space @ beginning of text field using swift? looked @ post

padding of text field

i don't understand subclass doing , how use class padding.

thank much

https://stackoverflow.com/a/27066764/846780

this answer clear,

  1. if subclass uitextfield can override textrectforbounds, editingrectforbounds , placeholderrectforbounds. these methods allow add rect (frame) textfield's label.

  2. newbounds method create rect (frame) added textfield's label.

  3. finally padding is: let padding = uiedgeinsets(top: 0, left: 5, bottom: 0, right: 5);

  4. now have custom uitextfield has custom padding.

  5. if create new subclass class mytextfield: uitextfield example, need change class of uitextfield you've added ib file.

enter image description here


Comments

Popular posts from this blog

Upgrade php version of xampp not success -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -