UIWebView如何监听滚动事件

从iOS 5.0以后 UIWebView本身就有scrollView属性

self.webView.scrollView.delegate = self;
// 开始
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
    [UIView animateWithDuration:0.2 animations:^{
        self.bannerMenu.alpha = 0.3;
    }];
}

// 结束
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
    [UIView animateWithDuration:0.2 animations:^{
        self.bannerMenu.alpha = 1;
    }];
}

你可能感兴趣的:(UIWebView如何监听滚动事件)