0
我有两个标签,并使用一个归属字符串设置backgroundColor。使用backgroundcolor将标签字符串设置为标签
NSString *string = @"This is a UILAbel with two lines";
NSMutableAttributedString *mutableString = [[NSMutableAttributedString alloc]initWithString:
string];
[mutableString setAttributes:@{NSBackgroundColorAttributeName : [UIColor redColor]} range:NSMakeRange(0, string.length)];
如果文本产生换行符,则将backgroundColor填充到右边框,在第二行中它将停在最后一个字符处。
但我想第一行中的backgroundcolor也设置为最后一个字符。
你可以显示你的问题或你想要的图像。 –
你是如何得到正确的照片? –
您正在将背景颜色设置为红色...对我来说看起来很漂亮:p –