这是我编写的代码,但是当用户在文本字段中但没有文本时,文本字段中仍然出现占位符,并且还显示在浮动标签中,当我在此文本字段中时,我只想删除
func setupGoogleMaterialTextFields(textFields: [MDCOutlinedTextField]) {
let containerShceme = MDCContainerScheme()
let colorScheme = MDCSemanticColorScheme()
colorScheme.primaryColor = UIColor.white
colorScheme.onSurfaceColor = UIColor.white
containerShceme.colorScheme = colorScheme
for textField in textFields {
textField.label.text = textField.placeholder
textField.font = UIFont.myMediumSystemFont(ofSize: 18)
textField.attributedPlaceholder = NSAttributedString(string: textField.placeholder ?? "",
attributes: [NSAttributedString.Key.foregroundColor: UIColor.white,
NSAttributedString.Key.font: UIFont.myMediumSystemFont(ofSize: 16)])
textField.containerRadius = 8
textField.sizeToFit()
textField.applyTheme(withScheme: containerShceme)
}
}