NSString *string1 = @"<font color = \"red\">什么情况</font><br/>";

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

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

    label1.attributedText = attribute;

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

    [self.view addSubview:label1];

 

posted on 2015-12-01 22:11  转身看见海  阅读(977)  评论(0编辑  收藏  举报