You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/01/02 19:08:35 UTC

[08/14] git commit: CB-5594 Add disallowoverscroll option.

CB-5594 Add disallowoverscroll option.

Similar to the main cordova webview


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

Branch: refs/heads/master
Commit: f75b30857b18a86f229c9d4baaf2f16afd028c7b
Parents: 25d152b
Author: ivan baktsheev <do...@gmail.com>
Authored: Sun Nov 10 22:58:18 2013 +0300
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Dec 13 09:25:46 2013 -0500

----------------------------------------------------------------------
 src/ios/CDVInAppBrowser.h |  1 +
 src/ios/CDVInAppBrowser.m | 13 +++++++++++++
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/f75b3085/src/ios/CDVInAppBrowser.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h
index 885d522..581bcd0 100644
--- a/src/ios/CDVInAppBrowser.h
+++ b/src/ios/CDVInAppBrowser.h
@@ -54,6 +54,7 @@
 @property (nonatomic, assign) BOOL keyboarddisplayrequiresuseraction;
 @property (nonatomic, assign) BOOL suppressesincrementalrendering;
 @property (nonatomic, assign) BOOL hidden;
+@property (nonatomic, assign) BOOL disallowoverscroll;
 
 + (CDVInAppBrowserOptions*)parseOptions:(NSString*)options;
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/f75b3085/src/ios/CDVInAppBrowser.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m
index 8b8f46b..60d2fb4 100644
--- a/src/ios/CDVInAppBrowser.m
+++ b/src/ios/CDVInAppBrowser.m
@@ -149,6 +149,18 @@
     }
     self.inAppBrowserViewController.modalTransitionStyle = transitionStyle;
 
+    // prevent webView from bouncing
+    if (browserOptions.disallowoverscroll) {
+        if ([self.inAppBrowserViewController.webView respondsToSelector:@selector(scrollView)]) {
+            ((UIScrollView*)[self.inAppBrowserViewController.webView scrollView]).bounces = NO;
+        } else {
+            for (id subview in self.inAppBrowserViewController.webView.subviews) {
+                if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
+                    ((UIScrollView*)subview).bounces = NO;
+                }
+            }
+        }
+    }
   
     // UIWebView options
     self.inAppBrowserViewController.webView.scalesPageToFit = browserOptions.enableviewportscale;
@@ -852,6 +864,7 @@
         self.keyboarddisplayrequiresuseraction = YES;
         self.suppressesincrementalrendering = NO;
         self.hidden = NO;
+        self.disallowoverscroll = NO;
     }
 
     return self;