CB-5594 Add disallowoverscroll option.

Similar to the main cordova webview
This commit is contained in:
ivan baktsheev 2013-11-10 22:58:18 +03:00 committed by Andrew Grieve
parent 25d152b578
commit f75b30857b
2 changed files with 14 additions and 0 deletions

View File

@ -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;

View File

@ -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;