gpt4 book ai didi

ios - 更改 UILabel 的文本颜色

转载 作者:IT王子 更新时间:2023-10-29 07:46:43 26 4
gpt4 key购买 nike

您好,我试图在我的一个 View 中更改 UILabel 的文本颜色,但没有成功。

在这段代码中有什么很明显我没有做的事情吗?

self.nameTopRight.backgroundColor = [UIColor redColor];
self.nameBottomRight.textColor = [UIColor redColor];

最佳答案

OP 已经回答了这个问题,但是为了其他来这里尝试更改标签文本颜色的人,请使用 textColor 属性:

swift

myLabel.textColor = UIColor.red  // or .red

objective-C

myLabel.textColor = [UIColor redColor];

关于ios - 更改 UILabel 的文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6951482/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com