uiwebview缩放和图像宽度问题
我使用 UIWebView 加载由字符串构造的 html。 请参阅下面的代码。我有 2 个可能相关的问题:
有限缩放:在缩放 ~2 后停止缩放,但我希望用户能够一直缩放到我理解的最大值 10。(最小 - scale 和 Maximum-scale 属性也会影响更改方向时的行为。这些属性值的范围是从 >0 到 10.0。[src:safari 参考库])所以即使我。将最大比例设置为 10,我只能缩放 ~2。
如果您有任何想法,请告诉我为什么会这样。图像尺寸横向/纵向不正确:img 的宽度属性设置为 480,因此如果用户想要横向模式,图像会填充整个可用宽度。我的问题是,在纵向模式下,图像不会调整大小/缩小到 320。我可以将 480 正则表达式为 320,但横向模式下会有小图像。
下面是一个 img 的示例:
以及构建 html 的代码(请注意 %@ 被包含
标签的各种 html 替换)
<html>
<head>
<meta name = \"viewport\" content = \"width=device-width, initial-scale = 1.0, user-scalable = yes, maximum-scale:10.0\">
<title></title>
</head>
<body style=\"-webkit-text-size-adjust:none\" bgcolor=\"White\" link=\"#0099ff\" vlink=\"#808080\" alink=\"#FF0000\" text=\"#000000\">
<font face=\"arial\" size='3'>
<h3>%@</h3>
</font>
<font face=\"arial\" size='2'><p align='right'>Posted on: %@<br>Author: <b>%@</b><br></a>Comments: %@</p>
</font>
<font face=\"arial\" size='2'>"
</font>
</body>
</html>`
感谢您的任何见解!
I use UIWebView
to load html constructed from strings.
Please see the code below. I have 2 possibly related problems:
limited zooming: it stops zooming after a scale ~2, but I would like the user to be able to zoom all the way up to the maximum which I understand is 10. (The minimum-scale and maximum-scale properties also affect the behavior when changing orientations. The range of these property values is from >0 to 10.0. The default value for both these properties is 0.25. [src: safari reference library]) So even though I set the maximum-scale to 10, I am only able to zoom ~2.
Please let me know if you have any ideas why that is.incorrect image size landscape/portrait: the img has the width property set to 480 so in case the user wants the landscape mode, the image fills the whole available width. My problem is that in portrait mode the image is not resized/shrinked to 320. I could regex the 480 to 320, but then landscape would have small images.
Below is an example of an img:
And the code for constructing the html (please note the %@ is replaced by all kinds of html containing <p>
<img>
tags)
<html>
<head>
<meta name = \"viewport\" content = \"width=device-width, initial-scale = 1.0, user-scalable = yes, maximum-scale:10.0\">
<title></title>
</head>
<body style=\"-webkit-text-size-adjust:none\" bgcolor=\"White\" link=\"#0099ff\" vlink=\"#808080\" alink=\"#FF0000\" text=\"#000000\">
<font face=\"arial\" size='3'>
<h3>%@</h3>
</font>
<font face=\"arial\" size='2'><p align='right'>Posted on: %@<br>Author: <b>%@</b><br></a>Comments: %@</p>
</font>
<font face=\"arial\" size='2'>"
</font>
</body>
</html>`
Thanks for any insight!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论