iOS开发笔记-122:swift5, UITextField 占位符 clearButton 改色

clearButton 改色

class JJWhiteClearColorTextField: UITextField {
    override func layoutSubviews() {
        super.layoutSubviews()

        for view in subviews {
            if let button = view as? UIButton {
                button.setImage(button.image(for: .normal)?.withRenderingMode(.alwaysTemplate), for: .normal)
                button.tintColor = .white
            }
        }
    }
}

占位符 改色

let  JJTF = JJWhiteClearColorTextField()
JJTF.tintColor = UIColor.white

你可能感兴趣的:(iOS开发笔记-122:swift5, UITextField 占位符 clearButton 改色)