cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject cordova-plugins git commit: CB-8839 - WKWebView ignores DisallowOverscroll preference
Date Sun, 19 Apr 2015 07:51:50 GMT
Repository: cordova-plugins
Updated Branches:
  refs/heads/master eb0e72af9 -> 8507344cc


CB-8839 - WKWebView ignores DisallowOverscroll preference


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugins/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugins/commit/8507344c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugins/tree/8507344c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugins/diff/8507344c

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

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


http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/8507344c/wkwebview-engine/src/ios/CDVWKWebViewEngine.m
----------------------------------------------------------------------
diff --git a/wkwebview-engine/src/ios/CDVWKWebViewEngine.m b/wkwebview-engine/src/ios/CDVWKWebViewEngine.m
index 65b1bd5..d7c2d78 100644
--- a/wkwebview-engine/src/ios/CDVWKWebViewEngine.m
+++ b/wkwebview-engine/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: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message