在 Xcode 中将图像加载到 UIWebView
我正在尝试制作 1 个页面视图来从某个链接加载图像,我已经设法做到了这一点,但图片不适合所有视图,我计划它覆盖整个视图,但它只是覆盖了大约 80%,这意味着它仍然漂浮在左侧。我是否需要定义任何代码或属性来使页面拉伸以适合整个视图?
提前致谢。
I'm trying to make 1 page view to load and image from certain link, I've manage to do that, but the picture didn't fit all the view, I'm planning it to cover the whole view, but it only cover around 80% of it, which mean it still floating in the left side. Is there any code or attribute I need to define to make the page being stretch to fit the whole view?
Thanx in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为正确的方法是向您的图像添加一些 css 样式(如果您可以操作 html),以便您可以控制其大小和位置...
编辑:如果您将 UIWebView 设置为直接加载图像,你可以尝试(我不知道你是否可以接受)将图像包装在这样的HTML片段中:
这样你就可以通过CSS控制它的大小和位置......
i think the right approach to this would be adding some css-style to your image (if you can manipulate your html) so that you can control its size and placement...
EDIT: if you set your UIWebView to directly load an image, you could try (I don't know if it is acceptable for you) to wrap the image in a HTML snippet like this:
so that you can control its size and position through CSS...
您可以为您的网站设置自定义元视口。
You could set a custom meta viewport for your site.