UILabel 富文本功能

用到的是 Ios的富文本功能

NSString  * htmlString = @" Some html string \n This is some text!";
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];
UILabel 富文本功能_第1张图片
富文本.png

你可能感兴趣的:(UILabel 富文本功能)