【发布时间】:2019-09-19 04:48:56
【问题描述】:
我需要知道是否可以更改文本字段中的清除按钮(放置图像)(我正在使用 Material 中的文本字段 -> https://github.com/CosmicMind/Material)
我找到了一些可能的代码:
let customClearButton = UIButton.appearance(whenContainedInInstancesOf: [UITextfield.self])
customClearButton.setBackgroundImage(UIImage(named: "icon_info"), for: .normal)
但是当我输入我的文本字段时它不起作用,错误是:
无法转换“TextField”类型的值?到预期的元素类型 'UIAppearanceContainer.Type'
非常感谢您的帮助。
【问题讨论】: