ios - UIButton 标题文本颜色

我正在为 UIButton

设置文本颜色
headingButton.titleLabel.textColor = [UIColor colorWithRed:36/255.0 
                                                     green:71/255.0 
                                                      blue:113/255.0 
                                                     alpha:1.0];

它不会改变我在另一个工作代码中使用的相同代码的颜色。

最佳答案

使用

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)

https://stackoverflow.com/questions/6703699/

相关文章:

ios - 何时使用 dequeueReusableCellWithIdentifier 与 deq

ios - Xcode 调试器不打印对象并显示 nil,当它们不是时

ios - 更改 UIImageView 的图像时淡入淡出/溶解

objective-c - cocoa objective-c类中变量前面的下划线如何工作?

ios - 带有隐藏 UIView 的自动布局?

ios - 错误 : _handleNonLaunchSpecificActions in iOS9

ios - 如何在 UITableViewCell 之间添加间距

objective-c - 仅在 iOS 7 上运行时,Storyboard 原型(prototyp

ios - 在 iOS 6 中以编程方式打开 map 应用

objective-c - 从 NSString 中删除除数字之外的所有数字