您的位置:首页 > 其它

不同颜色文字拼接显示

2015-12-21 09:56 435 查看
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"距离开课还有%@天",[NSString stringWithFormat:@"%@",[[response objectForKey:@"message"] objectForKey:@"days"]]]];

[str addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:255/255.0 green:0/255.0 blue:0/255.0 alpha:1] range:NSMakeRange(6,[[NSString stringWithFormat:@"%@",[[response objectForKey:@"message"] objectForKey:@"days"]] length])];

_dayCount.attributedText = str;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: