I am loading a UIWebview of a hosted .jpg. It’s actually a schedule, so it is a rather large image. Instead of having users have to zoom in right away, I would like to load the web view already zoomed in. Although I still need the user to be able to zoom in and out, and scroll. Basically I am just looking for an “initial” zoom. How would I accomplish this? Just FYI I put the method below I am using to load the image…Thanks!
// Webview code
NSString *urlAddress = @"http://www.google.com";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webview loadRequest:requestObj];
In iOS 5 you can access the
UIWebView‘sscrollViewproperty and set the zoom level on it after the page has loaded. That would likely work as you wanted. To get the same thing on pre-iOS 5 you’d probably want to go through theUIWebView‘s subviews until you find aUIScrollViewand do the same thing on that.I don’t think there’s any other way to programatically zoom it. Unless you can do it with Javascript and execute some using
UIWebView‘sstringByEvaluatingJavaScriptFromString:method.