SDK中更改Web视图的字体大小

SDK中更改Web视图的字体大小

本文介绍了在Iphone SDK中更改Web视图的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了Feed解析和以字符串形式获取内容.现在,我正在以编程方式制作html文件.在Web视图中加载该HTML.我的Web视图是表视图"单元格中的子视图.

I have implementing feed parsing & get the content as a string. Now, I am making html file through it programetically. Load that HTML in the Web view. My web View is the subview in Table View cell.

但是现在我想更改Web视图内容的字体大小,以便用户可以看到一些细节.

But Now i want to change the font size of web view content, so the user can see some detail .

我用于生成HTML的代码是:

My code for HTML generation is:

NSString * postHTML=[[_parseResults objectAtIndex:indexPath.row]valueForKey:@"summary"];

 NSString *close =[NSString stringWithFormat:@"</body></html>"];

    NSString *HTMLString = [NSString stringWithFormat:@"%@%@", postHTML,close];

    [Web_view loadHTMLString:HTMLString baseURL:nil];

[cell.contentView addSubview:Web_view];

return cell;

如何更改网页视图内容的字体大小?

推荐答案

[myWeb loadHTMLString:[NSString stringWithFormat:@"<div style='text-align:justify; font-size:45px;font-family:HelveticaNeue-CondensedBold;color:#0000;'>%@%@",postHTML,close] baseURL:nil];

您可以在font-size中设置字体大小:在代码中设置大小.

you can set font size in font-size:size in code.

尝试这个..让我知道它是否有效!!!

try this..let me know it is working or not!!!

这篇关于在Iphone SDK中更改Web视图的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 10:03