Stopping overscroll / bounce in Phonegap IOS

前端 未结 20 1603
青春惊慌失措
青春惊慌失措 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 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.

提交回复
热议问题