已有的是:
想要实现的是:
文本框的内容,距离文本框最左边有段距离:
swift textfield content padding
How to set padding for UITextField in Swift — Simple Swift programming tips — Medium
ios – How do I create space at beginning of UiTextField? SWIFT – Stack Overflow
ios – set the padding of a text field using swift in xcode – Stack Overflow
然后用:
let leftPaddingView = UIView() leftPaddingView.frame = CGRectMake(0, 0, 10, textFieldHeight) userTextField.leftView = leftPaddingView userTextField.leftViewMode = UITextFieldViewMode.Always |
效果是:
转载请注明:在路上 » [已解决]swift给文本框的内容添加填充