ios - 从服务器接的数据包含有html格式,使用NSAttributedString显示,但是如何能够修改字体大小。
PHP中文网
PHP中文网 2017-04-17 17:58:31
0
2
312

从服务器接的数据包含有html格式,使用
NSDictionary *dict = @{NSFontAttributeName:[UIFont systemFontOfSize:24.0f]};

[[NSAttributedString alloc] initWithData:@xxxxx"" dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:&dict error:nil];,
不起作用,字体还是很小,如何解决。

PHP中文网
PHP中文网

认证高级PHP讲师

Antworte allen(2)
大家讲道理

可以使用NSString *htmlString = [NSString stringWithFormat:@"<head><style>body{font-family:arial,Helvetica;font-size:15;word-wrap:break-word;}</style></head>"];去拼接到返回的string上

阿神

你这个初始化化方法不是系统的吧。你去看看是不是这个方的逻辑法错了

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!