码迷,mamicode.com
首页 > 移动开发 > 详细

ios开发之 用UILabel显示html

时间:2015-07-29 10:28:46      阅读:905      评论:0      收藏:0      [点我收藏+]

标签:

NSString * htmlString = @"<html><body> Some html string \n <font size=\"13\" color=\"red\">This is some text!</font> </body></html>";  
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显示html

标签:

原文地址:http://my.oschina.net/linxiaoxi1993/blog/484971

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!