fix(WKWebView Scrolling): fixed broken scroll (#372)

fixes #371
This commit is contained in:
Thibault Malbranche
2019-03-01 10:46:53 +01:00
committed by GitHub
parent 211ae18971
commit 2cef5cbb3f
+3 -8
View File
@@ -341,19 +341,14 @@ static NSURLCredential* clientAuthenticationCredential;
{ {
_scrollEnabled = scrollEnabled; _scrollEnabled = scrollEnabled;
_webView.scrollView.scrollEnabled = scrollEnabled; _webView.scrollView.scrollEnabled = scrollEnabled;
// Override the scrollView delegate to prevent scrolling.
if (!scrollEnabled) {
_webView.scrollView.delegate = self;
} else {
_webView.scrollView.delegate = _webView;
}
} }
- (void)scrollViewDidScroll:(UIScrollView *)scrollView - (void)scrollViewDidScroll:(UIScrollView *)scrollView
{ {
// Don't allow scrolling the scrollView. // Don't allow scrolling the scrollView.
scrollView.bounds = _webView.bounds; if (!_scrollEnabled) {
scrollView.bounds = _webView.bounds;
}
} }
- (void)setShowsHorizontalScrollIndicator:(BOOL)showsHorizontalScrollIndicator - (void)setShowsHorizontalScrollIndicator:(BOOL)showsHorizontalScrollIndicator