小编Ald*_*ila的帖子

如何制作具有多种颜色的单个UILabel

我想用2种颜色创建一个uilabel.第一种颜色是黑色,另一种颜色是蓝色.

我可以在其中使用多个uilabel,但我想只有一个uilabel.有什么办法可以实现吗?

这应该是输出.

在此输入图像描述

这是我的代码:

UILabel * lblPostContent = [[UILabel alloc] initWithFrame:CGRectMake((ICON_PADDING*1.5), 42, container.frame.size.width-30, 34)];
lblPostContent.numberOfLines =0;
[lblPostContent setFont:[UIFont systemFontOfSize:11]];
[lblPostContent setText:[NSString stringWithFormat:@"I just scored %d points at %@ using the iBowl app", score, LuckyStrikes]];
[container addSubview:lblPostContent];
Run Code Online (Sandbox Code Playgroud)

textcolor nsattributedstring uilabel uicolor ios

2
推荐指数
2
解决办法
7570
查看次数

标签 统计

ios ×1

nsattributedstring ×1

textcolor ×1

uicolor ×1

uilabel ×1