Have tried many suggestions from this and other forums, including setting "DisallowOverscroll" to "true". Is this broken in phonegap 3.0 by any chance ?
In the file AppDelegate.h, after initialized the MainViewController, you could disable this bouncing by set the scrollView class inside the webview by :
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
....................
self.viewController.webView.scrollView.bounces = NO;
return YES;
}
The configuration value in the file config.xml was not used, I searched all in Cordova project.
Make certain changes in config.xml
,
If you are using it for Android, then use
<preference name="disallowOverscroll" value="true" />
<preference name="webviewbounce" value="false" />
And for IOS, use like
<preference name="DisallowOverscroll" value="true" />
<preference name="webviewbounce" value="false" />
Hope this helps you.
EDIT
Do a cordova build
after you have made changes in the config.xml
file so that the changes affect to your project. The above steps would solve your problem only after you do a cordova build
this is method i've used in xcode way. i dont know how to solve that issue in phonegap maybe this few codes give you idea
in viewdidload:
webView.scrollView.delegate = self;
[webView.scrollView setShowsHorizontalScrollIndicator:NO];
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (scrollView.contentOffset.x > 0 || scrollView.contentOffset.x < 0 )
scrollView.contentOffset = CGPointMake(scrollView.contentOffset.y, 0);
}
For Cordova 3.x and above I believe you can set up your (void)webViewDidFinishLoad
in MainViewController.m
as follows :
- (void)webViewDidFinishLoad:(UIWebView*)theWebView {
// Black base color for background matches the native apps
theWebView.backgroundColor = [UIColor blackColor];
theWebView.scrollView.bounces = NO;
return [super webViewDidFinishLoad:theWebView];
}
Tested: Cordova 3.4, 3.5.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With