How to prevent app running in phone-gap from scrolling vertically?

后端 未结 14 1803
伪装坚强ぢ
伪装坚强ぢ 2020-12-22 17:42

I\'m trying out phone gap and I want my application to not scroll up and down when the user drags their finger across the screen. This is my code. Can anyone tell me why it\

14条回答
  •  囚心锁ツ
    2020-12-22 18:07

    You didn't say if this is a native app or a web app.

    If this is a native app you can turn off scrolling on the webview

    UIScrollView* scroll;  //
    for(UIView* theWebSubView in self.webView.subviews){  // where self.webView is the webview you want to stop scrolling.
        if([theWebSubView isKindOfClass:[UIScrollView class] ]){
            scroll = (UIScrollView*) theWebSubView;
            scroll.scrollEnabled = false;
            scroll.bounces = false;
        }
    }
    

    otherwise here is a link on the phonegap wiki for preventing scrolling. http://wiki.phonegap.com/w/page/16494815/Preventing-Scrolling-on-iPhone-Phonegap-Applications

提交回复
热议问题