UIButton标题文字颜色 [英] UIButton title text color

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

问题描述

我为设置文本颜色UIButton

headingButton.titleLabel.textColor = [UIColor colorWithRed:36/255.0 
                                                     green:71/255.0 
                                                      blue:113/255.0 
                                                     alpha:1.0];

它没有改变颜色与我正在使用的其他代码中使用的相同代码。

It's not changing color same code I'm using in another code it's working.

推荐答案

使用

Objective-C

[headingButton setTitleColor:[UIColor colorWithRed:36/255.0 green:71/255.0 blue:113/255.0 alpha:1.0] forState:UIControlStateNormal];

Swift

headingButton.setTitleColor(.black, for: .normal)

这篇关于UIButton标题文字颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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