【问题标题】:Is there any function that can increase blur on Textfield background when selected? TVOS是否有任何功能可以在选择时增加 Textfield 背景的模糊度?电视操作系统
【发布时间】:2021-02-09 04:42:16
【问题描述】:

我有一个文本字段,我想在文本字段成为焦点时增加模糊不透明度,我不确定是否有内置函数可以更改 TVOS 中模糊不透明度的背景。

谢谢

【问题讨论】:

    标签: ios swift tvos


    【解决方案1】:

    您可以使用 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
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-20
      • 2018-04-17
      • 1970-01-01
      • 1970-01-01
      • 2014-01-10
      相关资源
      最近更新 更多