富文本名称

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阴影

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容