iOS中的UIlabel在html中显示文字(特殊字符显示为&hellip,&yen等样式)

    xiaoxiao2025-05-27  10

    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];

    转载请注明原文地址: https://ju.6miu.com/read-1299319.html
    最新回复(0)