选中时更改按钮文本颜色 [英] Changing the button text color when selected

查看:73
本文介绍了选中时更改按钮文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义按钮,我在突出显示时设置不同的图像。现在,我想在突出显示按钮时更改按钮上文本的颜色。是否可以这样做?

I have a custom button and I am setting the different image when it is highlighted. Now, I want to change the color of the text on the button when button is highlighted. Is it possible to do this?

推荐答案

你可以这样做:

[myButton setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted];

这篇关于选中时更改按钮文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆