IB 中 UITextField 修改高度和水印大小。Swift5
// 输入入账金额
@IBOutlet weak var enterMoney: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// 修改高度
var rect = enterMoney.frame
rect.size.height = 50;
enterMoney.frame = rect
//字体大小
enterMoney.attributedPlaceholder = NSAttributedString.init(string:"输入入账金额", attributes: [NSAttributedString.Key.font:UIFont.systemFont(ofSize:25)])
//字体颜色
enterMoney.attributedPlaceholder = NSAttributedString.init(string:"输入入账金额", attributes: [ NSAttributedString.Key.foregroundColor:UIColor.red])
// 此方法已经不能用
// enterMoney.setValue(UIColor.lightGray, forKeyPath: "_placeholderLabel.textColor")
// enterMoney.setValue(UIFont.systemFont(ofSize: 25), forKeyPath: "_placeholderLabel.font")
}