从服务器接的数据包含有html格式,使用
NSDictionary *dict = @{NSFontAttributeName:[UIFont systemFontOfSize:24.0f]};
[[NSAttributedString alloc] initWithData:@xxxxx"" dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:&dict error:nil];,
不起作用,字体还是很小,如何解决。
You can use
NSString *htmlString = [NSString stringWithFormat:@"<head><style>body{font-family:arial,Helvetica;font-size:15;word-wrap:break-word;}</style></head>"];
to splice it into the returned stringYour initialization method is not systematic. Go and see if this method of logic is wrong