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 中的图像调整为视口大小


基础教程推荐
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01