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

查看:18
本文介绍了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];

斯威夫特

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

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

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