Custom UITextField clear button

前端 未结 7 742
渐次进展
渐次进展 2021-01-31 08:16

Is it possible to customize the image of the clear button in a UITextField? I have a dark textfield background and the \"x\" is not visible enough.

7条回答
  •  醉梦人生
    2021-01-31 09:14

    Swift 3

    let customClearButton = UIButton.appearance(whenContainedInInstancesOf: [UITextField.self])
    customClearButton.setBackgroundImage(UIImage(named: "custom_cb"), for: .normal)
    

提交回复
热议问题