Disable zoom in a UIWebView but keep other user interaction

纵饮孤独 提交于 2019-12-11 08:31:49

问题


I have a UIWebView that shows some text, I want to disable zoom/unzoom but I want to detect when users tap on a link. I have tried with disabling MultiTouch but zoom is still working.


回答1:


Setting the minimumZoomScale and maximumZoomScale on your webview's UIScrollView to be 1.0 should prevent the webview from zooming.

webview.scrollView.maximumZoomScale = 1.0;
webview.scrollView.minimumZoomScale = 1.0;



回答2:


Try this

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView 
{
  return nil;
}


来源:https://stackoverflow.com/questions/21653491/disable-zoom-in-a-uiwebview-but-keep-other-user-interaction

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!