Custom UITextField clear button

前端 未结 7 949
渐次进展
渐次进展 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 08:55

    You can access that property using KVO:

    UIButton *clearButton = [myTextField valueForKey:@"_clearButton"];
    [clearButton setImage:[UIImage new] forState:UIControlStateNormal];
    

提交回复
热议问题