首页 > 移动平台 > 详细

ios开发之 用UILabel显示html

时间:2015-07-29 10:28:20      阅读:216      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!