调整 UIWebView 内容的大小?
这里是菜鸟,所以可能需要一段时间才能理解出了什么问题,请继续关注.. 我的应用程序的主要目的是从 rss feed 下载 xml 文件,然后解析它并使用以下方法将其作为 html 文件传递到 webview:
内容后的 [webView loadHTMLString:aString baseURL:nil]
发生在网页视图中,它不适合漂亮和整洁,而是内容中的一些照片的宽度大于无需水平滚动即可立即显示的宽度,以及您的网页视图末尾的附件必须向右或向左滚动一点才能阅读它的全名,如果内容可以拉伸,这样就可以在不水平滚动的情况下看到它,那就太好了。
请注意,我将 webview 属性 scalesPageToFit 调整为 YES,但这将内容缩放到非常小的尺寸,以至于您无法阅读其中包含的内容! 有什么解决方案吗?
A noob here so it might take a while to understand what's the wrong, just follow along ..
the key purpose of my app is to download an xml file from rss feed then parse it and pass it as html file to a webview with this method: [webView loadHTMLString:aString baseURL:nil]
after the content took place in the webview it doesn't fit nice and neat instead there's some photos in the content that has a width larget than what it can be displayed at once without scrolling horizontally,as well as the attachments at the end of the webview you have to scroll a bit right or left to read the full name of it, it'd be nice if the content stretched so it can be seen without scrolling horizontally.
Notice that I adjusted webview property scalesPageToFit to be YES, but that scaled the content to very small size to the point that you can't read what it contains!
any solution around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用元/视口标签并设置内容宽度。请参阅此处的文档:
https://developer .apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html
You need to use a meta/viewport tag and se the content width. See documentation, here:
https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html