创建带样式的字符串AttributedString(富文本)
+ (id)stringWithDefaultStyle:(NSString *)string kern:(CGFloat)kernValue{ NSNumber *kern = ; NSNumber *underline = ; UIFont *font = ; UIColor*color = kOrange(1.0);NSDictionary *attrsDic = @{ NSKernAttributeName: kern, // 字间距 NSUnderlineStyleAttributeName: underline, // 下划线 NSForegroundColorAttributeName: color, // 字体颜色 NSFontAttributeName: font };
return [ initWithString:string attributes:attrsDic];}
页:
[1]