[PhoneGap]防止反弹只在主窗口 [英] [PhoneGap]preventing bounce ONLY in the main Window

查看:132
本文介绍了[PhoneGap]防止反弹只在主窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在使用最新版本的PhoneGap(3.4)和iOS7.1 beta3,我发现身体(也许调用UI视图元素)有一个不良的反弹属性,就像下面的图片,我想禁用它。我试图在网站上搜索,我只找到

< preference name =DisallowOverscrollvalue =false/>

适用于我,但我发现这个偏好使所有元素在我的应用程序中退回禁用,我只想禁用身体的反弹,就像下面的图片,并保持反弹在div元素。 p>

有没有办法解决此问题?



解决方案

但它不是常规的,因为它处理本机编码。在MainViewController中有一个名为webViewDidFinishLoad的方法。在该方法中包含此

WebView.scrollView.bounces = NO;



   - (void)webViewDidFinishLoad:(UIWebView *)theWebView 
{
//背景的黑底色匹配原生应用程序
theWebView.backgroundColor = UIColor blackColor];
theWebView.scrollView.bounces = NO;
return [super webViewDidFinishLoad:theWebView];
}

因为这是ios本地代码,所以这将工作在任何phonegap / cordova分配。


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 i want to disable it. I tried to search on the website, and i find only
<preference name="DisallowOverscroll" value="false" />
works for me, BUT i find this preference make bounce disabled in all elements in my App, and i just want to disable the body`s bounce just like the pic below, and keep bounce in div elements.

Is there any way to solve this issue out?

解决方案

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.

这篇关于[PhoneGap]防止反弹只在主窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆