【发布时间】:2021-02-09 04:42:16
【问题描述】:
【问题讨论】:
【问题讨论】:
您可以使用 UITextFieldDelegate 方法 textFieldShouldBeginEditing(_:) 来更改文本字段的不透明度。 UITextFieldDelegate 在 tvOS 中可用。将文本字段委托设置为视图控制器
@IBOutlet weak var textField:UITextField!
override func viewDidLoad(){
super.viewDidLoad()
textField.delegate = self
}
func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
textField.alpha = 1
return true
}
【讨论】: