iOS中的UIlabel在html中显示文字(特殊字符显示为&hellip,¥等样式)
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];
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];
相关文章推荐
- iOS UILabel利用NSMutableString显示不同样式的文字(富文本)
- HTML中显示特殊字符,如尖括号 “<”,">"等等
- HTML基础知识一(HTML、常见方式、文档结构、<meta>、 网站文件命名、文本修饰、文本样式、段落标记、居中标记、水平线标记、特殊字符、列表、图像)
- HTML快速入门8——HTML分隔符,一般语法,PRE标签,特殊字符显示
- HTML特殊字符显示
- html显示特殊字符(空格等) [大三TJB_708]
- HTML特殊字符显示实体
- HTML那点事之【特殊字符的显示】
- HTML特殊字符显示
- TextField htmlText 以及xml里"<" 和 ">" 等特殊字符的显示问题
- HTML特殊字符显示(字符实体)
- HTML特殊字符显示(字符实体)
- html 特殊字符(转)
- HTML标记【其他特殊文字样式标记】!
- 【html&css】Html&Css 特殊字符编码大全
- html中字体,特殊字符和标签如何显示呢?
- HTML之三:文字控制及特殊字符
- 字符串内特殊字符在html_javascript_xml等内使用时的转换 ,"缺少十六进制数字"错误的处理
- HTML 显示特殊字符时转义操作
- iOS&nbsp;UIlabel&nbsp;自动换行,文字自适应