我尝试将属性分配给字符串的最后 3 个字符newClock
,即@"3:33:23"
.
但是在构造时出现错误NSRange
:
NSMutableAttributedString *mas = [[NSMutableAttributedString alloc]initWithString:newClock];
[mas addAttributes:@{NSForegroundColorAttributeName:[UIColor grayColor],
NSFontAttributeName:[UIFont fontWithName:@"HelveticaNeue-Light" size:12]}
range:NSMakeRange(newClock.length-3,newClock.length)];