You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by sh...@apache.org on 2015/09/09 00:02:51 UTC

[14/19] cordova-plugin-wkwebview-engine git commit: CB-8839 - WKWebView ignores DisallowOverscroll preference

CB-8839 - WKWebView ignores DisallowOverscroll preference


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/commit/fa97a17a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/tree/fa97a17a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/diff/fa97a17a

Branch: refs/heads/master
Commit: fa97a17abe14c8e1012910cb9250ec0c2e9d61e1
Parents: cc2bdfb
Author: Shazron Abdullah <sh...@apache.org>
Authored: Sun Apr 19 00:51:49 2015 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Sun Apr 19 00:51:49 2015 -0700

----------------------------------------------------------------------
 src/ios/CDVWKWebViewEngine.m | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/fa97a17a/src/ios/CDVWKWebViewEngine.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVWKWebViewEngine.m b/src/ios/CDVWKWebViewEngine.m
index 65b1bd5..d7c2d78 100644
--- a/src/ios/CDVWKWebViewEngine.m
+++ b/src/ios/CDVWKWebViewEngine.m
@@ -129,6 +129,22 @@
      wkWebView.configuration.preferences.javaScriptEnabled = [settings cordovaBoolSettingForKey:@"JavaScriptEnabled" default:YES];
      wkWebView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = [settings cordovaBoolSettingForKey:@"JavaScriptCanOpenWindowsAutomatically" default:NO];
      */
+    
+    // By default, DisallowOverscroll is false (thus bounce is allowed)
+    BOOL bounceAllowed = !([settings cordovaBoolSettingForKey:@"DisallowOverscroll" defaultValue:NO]);
+    
+    // prevent webView from bouncing
+    if (!bounceAllowed) {
+        if ([wkWebView respondsToSelector:@selector(scrollView)]) {
+            ((UIScrollView*)[wkWebView scrollView]).bounces = NO;
+        } else {
+            for (id subview in wkWebView.subviews) {
+                if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
+                    ((UIScrollView*)subview).bounces = NO;
+                }
+            }
+        }
+    }
 }
 
 - (void)updateWithInfo:(NSDictionary*)info


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org