第一種方法:
self.userNumber.setValue(UIColor.lightGray, forKey: "_placeholderLabel.textColor")
self.userNumber.setValue(UIFont.systemFont(ofSize: 15), forKeyPath: "_placeholderLabel.font")
第二種方法:
? //字體大小
? textField.attributedPlaceholder = NSAttributedString.init(string:"輸入你需要的服務(wù)", attributes: [NSAttributedString.Key.font:UIFont.systemFont(ofSize:15)])
? //字體顏色
? textField.attributedPlaceholder = NSAttributedString.init(string:"輸入你需要的服務(wù)", attributes: [
? NSForegroundColorAttributeName:UIColor.red])