Friday, June 28, 2013

UIWebView detect scrolling

Today I'm trying to show and hide a View depending on the scrolling direction of a UIWebView.
Unfortunately just setting the delegate of the UIWebView in the storyboard (or in the code) is not enough  to get the method

- (void)scrollViewDidScroll:(UIScrollView *)scrollView

called.

That's because its not the delegate of the UIWebView that you want in this case but the delegate of its containing UIScrollview. So in your init method just set the following and you're done.

[self.eventUIWebView.scrollView setDelegate:self];

No comments: