简体   繁体   English

无法缩放UIWebView

[英]Cannot zoom UIWebView

Our application contains UIWebview which displays a HTML page that uses touch events for the display of some images. 我们的应用程序包含UIWebview,它显示一个HTML页面,该页面使用触摸事件来显示某些图像。 The problem is with zooming HTML content. 问题在于缩放HTML内容。 When the user touches the screen the html elements process it, and prevent default zooming behavior of the UIWebView. 当用户触摸屏幕时,html元素处理它,并防止UIWebView的默认缩放行为。 But I need both features. 但我需要这两个功能。 How can I solve the problem? 我该如何解决这个问题? Please help me. 请帮我。 Thanks in advance. 提前致谢。

Hi You need to turn on the Scale Page to Fit property of WebView to YES 您好需要打开WebView的Scale Page to Fit属性为YES

You can do this from Interface builder as follows 您可以从Interface builder执行此操作,如下所示 在此输入图像描述

or you can do the same by 或者你也可以这样做

[ webView setScalesPageToFit:YES]; [ webView setScalesPageToFit:YES];

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM