UILabel的字体颜色不变 [英] Font color for UILabel not changing

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

问题描述

我正在尝试在UILabel上以黑色粗体和50号显示数字.

I am trying to display numbers on a UILabel with a bold black font and size 50.

经过几次失败的尝试后,我才意识到,无论将字体设置为哪种颜色,它始终会设置为lightGray.除了以下内容,我还需要做其他事情吗?

After some failed attempts I just realized that no matter what color I set the font to, it always gets set to lightGray. Is there something else I need to do other than the below?

[DisplayLabel setFont:[UIFont fontWithName:[NSString stringWithUTF8String:"HelveticaNeue-Bold"] size:50]];
DisplayLabel.textColor = [UIColor brownColor];
DisplayLabel.textAlignment = NSTextAlignmentCenter;

我正在使用情节提要向视图添加标签.

I am adding the label using the storyboard to a view.

推荐答案

确保标签的行为是这样的.

Make sure your label's behavior like that.

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

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