Resize images in UIWebView to viewport size(将 UIWebView 中的图像调整为视口大小)
问题描述
我在我的 iPhone 应用程序的 UIWebView 中显示带有一些图像的 HTML.当图像比 iPhone 的视口宽时,我会得到我不想要的水平滚动条,因为它主要是关于文本而不是图像.
I'm displaying HTML with some images inside a UIWebView in my iPhone App. When the images are wider than the viewport of the iPhone I get horizontal scrollers which I don't want because its mostly about the text not the images.
有没有办法根据宽度调整 UIWebView 内显示的图像大小(最好:即使设备旋转)?
Is there a way to resize images displayed inside the UIWebView according to the width (best: even if the device is rotated)?
推荐答案
如果希望最大宽度为 webView 的宽度,请使用 max-width CSS 属性.
If you want the maximum width to be the width of the webView, use the max-width CSS property.
最大宽度:100%;宽度:自动;高度:自动;
max-width: 100%; width: auto; height: auto;
这篇关于将 UIWebView 中的图像调整为视口大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 UIWebView 中的图像调整为视口大小
基础教程推荐
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
