self.userPhone=UITextField()
1 设置左边leftview
letu_icon =UIImageView(frame: iconFrame)
u_icon.image=UIImage(named:"login_phone")
self.userPhone.leftView?.backgroundColor=THEMECOLOR
self.userPhone.leftView= u_icon
2 设置textfield框位移
self.userPhone.setValue(NSNumber(value:10), forKey:"paddingLeft")
3 设置占位字符大小
self.userPhone.setValue(UIFont.systemFont(ofSize:14), forKeyPath:"_placeholderLabel.font")
网友评论