How can I make a UITextField with padding on the left of the content? -


uitextfield shows content text bang against left edge of field, ugly , can hard read if field has visible border. uitextview, on other hand, automatically has padding (blank space) around text. examined , experimented uitextfield properties don't see way can used padding around text.

i tried calling drawtext(in:cgrect) on text field had no effect. i'm not sure cgrect needed in call. tried different border styles including .none. tried making blank uiview , assigning text field's leftview property had no effect. , tried doing these things in viewdidload, viewdidappear, , @ point i'm writing text textfield. text shows in textfield expected none of these other things seem affect textfield's appearance in way. seems me lots of people must show text in uitextfield , somehow padded on left i'm misunderstanding what???

the following works field called "textfield". inserts padding shifting left side of field's content 8 pixels right relative left edge of textfield:

textfield.layer.sublayertransform = catransform3dmaketranslation(8, 0, 0);

this given in answer different question user dhiru (reputation 1285) in nov. 2016. thank dhiru!

i have add not familiar either sublayertransform or catransform3dmaketranslation can't sure doesn't have side effect isn't obvious. i'm little worried it's called "3d transform" whereas there nothing 3d application. @ least seems answer question.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -