Objective-c – How to disable UIWebview horizontal scrolling

iphoneobjective cscrolluiwebview

I've tried disabling it by inserting:

<meta name="viewport" content="width=320" />

into my HTML string, and a dozen variations of the above in the vain hope that I just screwed up the tag syntax… but nothing seems to stop UIWebView from scrolling horizontally. And yet there are apps that manage to do this (like MobileRSS), and presumably, since they haven't gotten rejected, they're not using private APIs.

Best Answer

My version, a common solution:

- (void)webViewDidFinishLoad:(UIWebView *)webView {

[webView.scrollView setContentSize: CGSizeMake(webView.frame.size.width, webView.scrollView.contentSize.height)];

}