Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot scroll in UIWebView in iOS

I created a webview programmatically and I am unable to enable scrolling in this view.

How do I enable scrolling?

    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,40, 325, 1000)];
    webView.contentMode = UIViewContentModeScaleAspectFit;     
    [webView setBackgroundColor:[UIColor clearColor]];
    [webView loadHTMLString:html baseURL:nil];
    [self.view insertSubview:webView atIndex:0];

Thanks In Advance !

like image 276
Santhosh Avatar asked Jun 04 '12 03:06

Santhosh


1 Answers

To enable scrolling,

webview.scrollView.scrollEnabled = TRUE;

and instead of writing this,

webView.contentMode = UIViewContentModeScaleAspectFit;

write this,

webview.scalesPageToFit = TRUE;
like image 168
Krunal Avatar answered Sep 22 '22 06:09

Krunal