我正在制作一个脚本,允许用户更改元素的颜色。
该脚本旨在处理按钮上的文本。
我已经尝试过了:
func prettyText(_ button: RoundButton, colour: UIColor) {
button.textColor = colour
}
但是它给出了这个错误:
“ RoundButton”类型的值没有成员“ textColor”;你是说'tintColor'吗?
答案 0 :(得分:1)
UIButton
具有setTitleColor(_:for:)方法。所以就你而言
func prettyText(_ button: RoundButton, colour: UIColor) {
button.setTitleColor(colour, for: .normal)
}