Question

I have a WebView into which I'm loading a local HTML page with some embedded images. I want to allow the user to zoom in on the text and image in a similar fashion as they would with the web browser.

Any ideas how to enable this?

Thanks

Was it helpful?

Solution

Try to set UIWebView property scalesPageToFit to YES

OTHER TIPS

For completeness. You must enable multitouch, scalesPagesToFit to get it to work (there are some conditions if its within certain other views).

But then to prevent it scaling your webpage (especially if using local files). You will need to add the following snippet to your HTML

For more info so: http://iphoneincubator.com/blog/windows-views/right-scale-for-a-uiwebview

This is the code that works for me:

// declare and allocate UIWebView before
// UIWebView *webView;
// webView = [[UIWebView alloc] initWithFrame:CGRectMake(x, y, w, h)];
webView.scalesPageToFit = YES;

I used scalesPageToFit to YES.... it allows it to zoom in some... but not a true zoom like safari has.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top