uiwebview显示html真的很小......?

时间:2013-01-09 12:56:07

标签: iphone html uiwebview

我在我的iPhone应用程序中使用uiwebview。 我用本地html文件绑定它,但它没有显示我正确。 我的html文件代码

<html>
<head>
    <title></title>
    <style type="text/css">
        h1 {font-family:arabic-indic;font-size:14px;font-weight:bold}       </style>
</head>
<body>
    <table align="center" border="0" width="100%">
        <tbody>
            <tr>
                <td>
                    <h1>
                        First Name</h1>
                </td>
                <td>
                    <h1>
                        9898337874</h1>
                </td>
            </tr>
            <tr>
                <td>
                    <h1>
                        Last Name</h1>
                </td>
                <td>
                    <h1>
                        mjain@jkvsolutions.com</h1>
                </td>
            </tr>
            <tr>
                <td>
                    <h1>
                        Image</h1>
                </td>
                <td>
                    <img alt="" src="http://wac.450f.edgecastcdn.net/80450F/929jackfm.com/files/2013/01/some-ecards-2.jpg" style="width: 90px; height: 90px; " /></td>
            </tr>
        </tbody>
    </table>
</body>

当我在本地PC浏览器中打开相同的文件时,它在locla浏览器中显示正确。 但是用iphone uiwebview enter image description here

我在app中加载它的代码

    [tblwebview loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]
                                                                      pathForResource:@"htmlfile" ofType:@"htm"]isDirectory:NO]]];
for (id subview in tblwebview.subviews)
    if ([[subview class] isSubclassOfClass: [UIScrollView class]])
        ((UIScrollView *)subview).bounces = NO;

由于

2 个答案:

答案 0 :(得分:0)

取消选中属性“Scales Page To Fit”(如果已设置),然后重试。它对我的工作有很大的帮助,但是,我确实不得不花费大量时间来完善“杀手级”CSS来完全按照我的需要显示这些东西。

答案 1 :(得分:0)

在标题中添加以下元标记。

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">