VARUN SINGHAL
VARUN SINGHAL

Reputation: 373

UIWebView not zooming in iOS8

I want to zooming in out in WebView.I am newer in iOS.Please Help me.Some one say it is default property of WebView.I am testing in iOS8 . It does not work for me.

self.myWebView= [[UIWebView alloc] init];
[self.myWebView setScalesPageToFit:YES];
[self.myWebView setDelegate:self];
[self.myWebView.scrollView setDelegate:self];
[self.myWebView setDataDetectorTypes:UIDataDetectorTypeNone];
  [self.myWebView.scrollView setBounces:NO];
[self.myWebView.scrollView setShowsHorizontalScrollIndicator:NO];
[self.myWebView.scrollView setShowsVerticalScrollIndicator:NO];
[myScrollView addSubview:self.myWebView];

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

    self.myWebView.scrollView.delegate = self; 
 self.myWebView.scrollView.maximumZoomScale = 20; // set as you want.
    self.myWebView.scrollView.minimumZoomScale = 1; // set as you want.
}
 (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale
{
    self.myWebView.scrollView.maximumZoomScale = 20;
}

Upvotes: 1

Views: 189

Answers (1)

rohan thankur
rohan thankur

Reputation: 81

if u are not use viewForZoomingInScrollView they work automatically. if you are use viewForZoomingInScrollView 
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{

    if (scrollView ==myWebView.scrollView){

          return self.myWebView;
    }
    else
    {
        return nil;
    }
}

Upvotes: 1

Related Questions