iOS UILabel 加载 HTML文字

  
NSString * htmlString = resultDic[@"Result"][@"Content"];
        NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
        UILabel * myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, DeviceWidth, DeviceHeight/2)];
        myLabel.attributedText = attrStr;
        myLabel.numberOfLines = 0;
        myLabel.font =[UIFont systemFontOfSize:11.0];
        [self.view addSubview:myLabel];

你可能感兴趣的:(iOS UILabel 加载 HTML文字)