Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling zoom-in zoom-out functionality of the UIWebView

Tags:

ios

uiwebview

I am new to iOS development and I am developing an application which will show and web page in UIWebView. I want to get rid of the default zoom-in and zoom-out functionality of the webview.

like image 645
user1036201 Avatar asked Mar 09 '12 02:03

user1036201


People also ask

How do I stop zoom in and out?

Go to the Device Settings tab, then click the Settings button. Click Pinch Zoom from the left pane, then uncheck the Enable Pinch Zoom box.

How do I disable zoom in react native Webview?

Show activity on this post. How to disable zoom on react-native web-view ,is there a property like hasZoom={false} (just an example) that can be included in the below web-view tag that can disable zooming.


2 Answers

This is in the Apple Documentation:

@property(nonatomic) BOOL scalesPageToFit
Discussion
If YES, the webpage is scaled to fit and the user can zoom in and zoom out. If NO, user zooming is disabled. The default value is NO.

Interface Builder Approach:

  1. Make sure that the "Scale pages to fit" tick box in the right-side column of the interface builder when you click on your webview is un-ticked. It's right at the top.

  2. You're also going to need to un-tick the box that says "Multiple Touch" around half way down. That will disable pinching to zoom.

Code Approach:

You can also do it programmatically with this code:

webView.scalesPageToFit = NO;

You're also going to want to add:

webView.multipleTouchEnabled = NO;

That will disable the ability to pinch and zoom, since it disables the ability to use multiple fingers in an action, and pinching requires two, obviously!

like image 172
JTApps Avatar answered Oct 06 '22 10:10

JTApps


set the UIWebView property scalesPageToFit to NO, will disable the user zooming

myWebView.scalesPageToFit = NO;
like image 37
Wubao Li Avatar answered Oct 06 '22 08:10

Wubao Li