UILabel 加载html 字符串,以及设置带删除线的字符串
2016-08-22 本文已影响60人
瑞廷
//添加删除线
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"¥%@",self.data[indexPath.row][@"packTargetPrice"] ]attributes:@{NSStrikethroughStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleSingle] }];
cell.targetPriceLabel.attributedText = attribtStr;
//加载HTML字符串:
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[self.data[indexPath.row][@"packDesc"] dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
cell.midDetailLabel.attributedText=attrStr;