在Webview中缩放html内容 [英] Scale html content in Webview

查看:139
本文介绍了在Webview中缩放html内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将本地HTML模板加载到WebView中.我的网络视图的框架尺寸非常小(250X300).我用它只显示预览.问题是,我在webview中看不到整个html内容.我只能看到左上方.我必须滚动才能看到全部内容. 那么,是否有可能为WebView设置缩放比例或缩放比例?

I load a local HTML template into a WebView. My webview's frame size is very small (250X300). I use this to show only a preview. The problem is, I can't see the entire html content in the webview. I can see only the top left. I have to scroll to see the entire content. So is there any possiblity to set the scale or zoom factor for the webview?

推荐答案

经过一番游戏后,我得到了答案.

I got the answer after a little play around.

    [[[[[previewWeb mainFrame] frameView] documentView] superview] scaleUnitSquareToSize:NSMakeSize(.5, .5)];

这篇关于在Webview中缩放html内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆