Daemon Painter
Daemon Painter

Reputation: 3470

UIWebView Content is not resizable by user

I'm struck over this little issue and just can't figure a way out. My apologies and gratitude.

Description:

an UIView with fullscreen UIWebView targeted for iPhone programmatically loads a web page using viewDidLoad method. When running the app into the simulator UIWebView is displayed, the web page loaded, but no pinching is allowed. Thus, I can move around the page, but I can't resize with multigesture.

Details:

- (void)viewDidLoad {

   NSString *urlAddress = @"http://www.someurl.it";

   NSURL *url = [NSURL URLWithString:urlAddress];

   NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

   [webView loadRequest:requestObj];

   webView.userInteractionEnabled=YES;
   webView.autoresizingMask=YES;
   webView.multipleTouchEnabled=YES;

}

Upvotes: 0

Views: 101

Answers (2)

darwin
darwin

Reputation: 240

Just insert this line of code along with the other properties you set for the webview:

webView.scalesPageToFit = YES;

Upvotes: 2

CodaFi
CodaFi

Reputation: 43330

Because the proper property to set to allow UIWebView's to interpret pinch-to-zoom events is calledscalesPageToFit. Setting an autoresizingMask is a hint to the auto-rotational layout mechanism in UIView of where a view should be positioned in the new coordinate space of the given device.

Upvotes: 0

Related Questions