您的位置:首页 > 产品设计 > UI/UE

iOS中的UIlabel在html中显示文字(特殊字符显示为&hellip,&yen等样式)

2016-08-14 20:34 846 查看
NSString * htmlString = @" html的文字 \n这里填写内容";

NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];

UILabel * myLabel = [[UILabel alloc] initWithFrame:self.view.bounds];

myLabel.attributedText = attrStr;

[self.view addSubview:myLabel];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  html uilabel ios