2.常见的属性及说明
NSFontAttributeName字体
NSParagraphStyleAttributeName段落格式
NSForegroundColorAttributeName字体颜色
NSBackgroundColorAttributeName背景颜色
NSStrikethroughStyleAttributeName删除线格式
NSUnderlineStyleAttributeName下划线格式
UILabel*underlineLabel = [[UILabelalloc] initWithFrame:(CGRectMake(10,10,50,30))];NSString*textStr = [NSStringstringWithFormat:@"%@元", primeCost];// 下划线NSDictionary*attribtDic = @{NSUnderlineStyleAttributeName: [NSNumbernumberWithInteger:NSUnderlineStyleSingle]};NSMutableAttributedString*attribtStr = [[NSMutableAttributedStringalloc]initWithString:textStr attributes:attribtDic];//赋值underlineLabel.attributedText= attribtStr; [self.viewaddSubview:underlineLabel];
NSStrokeColorAttributeName删除线颜色
NSStrokeWidthAttributeName删除线宽度
NSShadowAttributeName阴影