[PhoneGap]preventing bounce ONLY in the main Window

前端 未结 2 1869
走了就别回头了
走了就别回头了 2021-02-02 01:04

I am now using the latest version of PhoneGap (3.4) and iOS7.1 beta3, and i find the body (maybe call UI View element) have a bad property of bounce just like the pic below, and

2条回答
  •  旧巷少年郎
    2021-02-02 01:46

    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, so this'll work in any phonegap/cordova distribution.

提交回复
热议问题