8suhas
8suhas

Reputation: 1460

Why Zooming in UIWebview is not working in iOS5?

I have implemented delegate for scrollview in webview. Since , iOS 5 the default scrollview is no longer responding to didZoom event. Why is this behavior ?

Upvotes: 3

Views: 441

Answers (1)

8suhas
8suhas

Reputation: 1460

The UIWebView object in iOS has a scrollview object which was exposed from iOS5 onwards with webView.scrollView property. Previously, webView was the delegate of the scrollview. Since, iOS5 webView is delegate for some methods and scrollview is delegate for other methods.

-(void) scrollViewDidZoom:(UIScrollView *)scrollView
{   

   if ([self->oldScrollViewDelegate respondsToSelector:@selector(scrollViewDidZoom:)])
   {
        //NSLog(@"forwarding scrollViewDidZoom");
    [self->oldScrollViewDelegate scrollViewDidZoom:scrollView];
   }
    else if ([self.webView respondsToSelector:@selector(scrollViewDidZoom:)]) 
   {
        //NSLog(@"forwarding scrollViewDidZoom");
    [self.webView scrollViewDidZoom:scrollView];
   }

}

Of course this is just a hack and not perfect solution.

Upvotes: 1

Related Questions