简体   繁体   English

UIWebView缩放问题

[英]UIWebView Zoom Issue

How can we identify that a user has zoomed the webView so as to resize the other components present. 我们如何确定用户已经缩放了webView以便调整其他组件的大小。 My webView starts from the middle of the screen and when a user zooms the webView it starts to scroll horizontally and vertically but it happens within the webView.The scrolling happens internally. 我的webView从屏幕中间开始,当用户缩放webView时,它开始水平和垂直滚动,但发生在webView内部。滚动发生在内部。 I want to lock the webView from scrolling internally so that when a user scrolls vertically, the labels,textfields etc. on top of the webView also scroll up and not the webView alone. 我想阻止webView内部滚动,以便当用户垂直滚动时,webView顶部的标签,文本字段等也会向上滚动,而不是单独滚动webView。 What I want to achieve is pretty similar to iPhone Native Email Client. 我想要实现的功能与iPhone Native Email Client非常相似。 For accomplishing this, I would like to put this webView on top of a scrollView and when a user zooms it, I would like to reset the content size of my scrollView so that whatever is added to the scrollView like labels and textfields above the webView also scroll when I scroll the webView. 为此,我想将此webView放在scrollView上,并且当用户缩放它时,我想重置自己的scrollView的内容大小,以便将添加到scrollView的内容(如webView上方的标签和文本字段)滚动webView时滚动。

Any ideas? 有任何想法吗?

You could do: 您可以这样做:

  • Disallow user to pinch zoom the webview 禁止用户捏缩放Web视图
  • Detect double tap on your scrollview and toggle webview's scalesPageToFit property AND set userInteractionDisabled on webview 检测双击滚动视图并切换Webview的scalesPageToFit属性并在webview上设置userInteractionDisabled

Now you can scroll only scrollview which has all the controls.. 现在,您只能滚动具有所有控件的scrollview。

You can find help from this 您可以从中找到帮助

Disabling default zoom effect and scalesPageToFit property 禁用默认缩放效果scalesPageToFit属性

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

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