【问题标题】:Why does app built with Phonegap and Moobile freeze on alert sometimes?为什么使用Phonegap 和Mobile 构建的应用程序有时会在警报时冻结?
【发布时间】:2013-01-30 05:19:39
【问题描述】:

我去了http://moobilejs.com/#download,下载了Moobile 0.2.1 Boiler Plate(这是一个基于MooTools构建的移动应用程序框架),将www文件放入Dreamweaver CS6,运行Phonegap Build Service,用我的扫描二维码安卓手机,并安装了应用程序。

我没有对代码进行任何更改。它只是一个应用程序,只有一个按钮,上面写着 Hello,它会打开一个警告框。您可以通过点击确定关闭警报框。

它在浏览器中运行良好。在我的 android 手机上它似乎工作正常,但是在点击 OK 关闭警报框后,它又回来了,你不能关闭它。第一次点击 Hello 时并不总是发生这种情况,但最终它总是会出现这个问题。更改方向会使其消失,但下次点击 Hello 时会出现同样的问题。

这可能是什么原因造成的?

编辑:这是视图:

<div class="hello-world-view">
    <div data-role="button" data-name="hello-world-button">Hello World</div>
</div>

这是 app.js 中的内容

if (!window.ViewController) window.ViewController = {};

var HelloWorldViewController = new Class({

    Extends: Moobile.ViewController,

    helloWorldButton: null,

    loadView: function() {
        this.view = Moobile.View.at('templates/views/hello-world-view.html');
    },

    viewDidLoad: function() {
        this.helloWorldButton = this.view.getChildComponent('hello-world-button');
        this.helloWorldButton.addEvent('tap', this.bound('onHelloButtonTap'));
    },

    destroy: function() {
        this.helloWorldButton.removeEvent('tap', this.bound('onHelloButtonTap'));
        this.helloWorldButton = null;
        this.parent();
    },

    onHelloButtonTap: function() {
        var alert = new Moobile.Alert();
        this.view.addChildComponent(alert);
        alert.setTitle('Hello');
        alert.showAnimated();
    }

});

【问题讨论】:

    标签: mobile cordova mootools phonegap-build


    【解决方案1】:

    这与 Momobile ScrollView 类和 IScroll 有关。

    这是来自 JP 在移动设备上的修复...

    1) 为滚动视图元素添加 data-option-scroller="IScroll" 属性

    示例&lt;div data-view="Moobile.ScrollView" data-option-scroller="IScroll"&gt;

    2) 在 app.js 文件的顶部添加以下 sn-p。

    Class.refactor(Moobile.ScrollView, { 
    options: {
    scroller: 'IScroll'
    }
    });
    

    【讨论】:

    • 我不认为我正在使用滚动视图。我编辑了我的问题以包含视图。
    猜你喜欢
    • 1970-01-01
    • 2022-01-16
    • 2013-07-16
    • 1970-01-01
    • 2012-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-09
    相关资源
    最近更新 更多