最新消息:20210917 已从crifan.com换到crifan.org

[已解决]swift给文本框的内容添加填充

Swift crifan 1726浏览 0评论

已有的是:

想要实现的是:

文本框的内容,距离文本框最左边有段距离:

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给文本框的内容添加填充

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
94 queries in 0.179 seconds, using 23.31MB memory