Search code examples
iphoneuiwebview

UIWebView disable zooming when scalesPageToFit is ON


Is there any way to disable zooming when Scales page to Fit is ON ??


Solution

  • This works for me:

    UIScrollView *scrollView = [webView.subviews objectAtIndex:0];
    scrollView.delegate = self;//self must be UIScrollViewDelegate
    
    - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
      return nil;
    }
    

    UPDATE: For iOS 5 or higher get scrollView like this:

    webview.scrollView.delegate = self;