Stopping overscroll / bounce in Phonegap IOS

前端 未结 20 1444
青春惊慌失措
青春惊慌失措 2020-12-07 18:53

I am using the latest version of Phonegap on IOS (ipad) and I can\'t seem to disable the vertical overscroll/bounce on the whole app. I don\'t mind it on inner elements but

相关标签:
20条回答
  • 2020-12-07 18:56

    In config.xml of your project, under preferences for iOS set DisallowOverscroll to true. By default it is false which makes whole view to scroll along with inner elements of the view.

    <preference name="DisallowOverscroll" value="true" />
    
    0 讨论(0)
  • 2020-12-07 19:00

    There is a way I used to achieve this. but it's not conventional because it's dealing with native coding. In the MainViewController there is a method named webViewDidFinishLoad. Include this
    theWebView.scrollView.bounces= NO;

    inside that method.

    - (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];
    }
    

    As this is ios native code this'll work in any phonegap/cordova distribution.

    0 讨论(0)
  • 2020-12-07 19:02

    Open xCode -> find and click on config.xml from left menu-> and change DisallowOverscroll value false to true Or use this code by replacing previous.

     <preference name="DisallowOverscroll" value="true" />
    
    0 讨论(0)
  • 2020-12-07 19:03

    If nothing else works, try to remove -webkit-overflow-scrolling: touch from your css...if you had it!

    0 讨论(0)
  • 2020-12-07 19:06

    It is better to modify two elements in config.xml as follows:

    <preference name="DisallowOverscroll" value="true"/>
    <preference name="UIWebViewBounce" value="false" />
    
    0 讨论(0)
  • 2020-12-07 19:07

    this is what worked for my app running phonegap 3.0: add the following line to config.xml

    <preference name="webviewbounce" value="false"/>
    
    0 讨论(0)
提交回复
热议问题