UILabel加載HTML

    NSString *string1 = @"<font color = \"red\">什麼狀況</font><br/>";code

    UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(100, 100, 200, 20)];string

    NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc]initWithData:[string1 dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType} documentAttributes:nil error:nil];it

    label1.attributedText = attribute;io

    label1.font = [UIFont systemFontOfSize:20.f];table

    [self.view addSubview:label1];coding

相關文章
相關標籤/搜索