I have a UIWebview
that is loaded as a subview when a user selects a tab on a UISegmentedControl
. For some reason, I can not get it to allow pinch/zooming
.
I set the following code in the viewDidLoad:
method, so it should work.
self.myWebView = [[[UIWebView alloc] initWithFrame:self.view.frame] autorelease];
self.myWebView.backgroundColor = [UIColor whiteColor];
self.myWebView.scalesPageToFit = YES;
self.myWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
self.myWebView.delegate = self;
[self.view addSubview: myWebView];
I tried loading a UIWebView
from a NIB and creating it programmatically with no avail. Is there something I'm missing? What could be causing the webview to ignore pinching and zooming?
Thanks!
[webView stringByEvaluatingJavaScriptFromString:@"document.body.style.zoom = 5.0;"];
seem to be the suitable solution