0

我在我的 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 在此处输入图像描述

我在应用程序中加载它的代码

    [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;

谢谢

4

2 回答 2

0

如果您设置了属性“缩放页面以适合”,请取消选中它,然后重试。它对我的工作帮助很大,但是,我确实必须花费大量时间完善“杀手级”CSS 才能完全按照我的需要显示内容。

于 2014-01-07T05:35:27.230 回答
0

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

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
于 2014-01-07T05:49:22.980 回答