美文网首页
UILabel 加载html 字符串,以及设置带删除线的字符串

UILabel 加载html 字符串,以及设置带删除线的字符串

作者: 瑞廷 | 来源:发表于2016-08-22 15:02 被阅读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;

    相关文章

      网友评论

          本文标题:UILabel 加载html 字符串,以及设置带删除线的字符串

          本文链接:https://www.haomeiwen.com/subject/wuqgsttx.html