0

我有一个奇怪的行为。我在 xcode 4.3 上运行我的 sencha touch 2/phonegap 2.0 应用程序

我的一些观点仅在模拟器/设备上没有加载。虽然它在浏览器上加载良好。

我没有在日志中得到任何特殊错误,所以我开始在视图中放置项目。最后我发现 XCODE 在识别某些 xtypes 时遇到问题,例如“fieldset”、“emailfield”、“passwordfield”等。在将“fieldset”更改为“container”并将字段更改为“textfield”后,我的视图已成功加载。奇怪啊?

这发生在以下代码中:

    /*
 * File: app/view/loginformpanel.js
 *
 * This file was generated by Sencha Architect version 2.2.2.
 * http://www.sencha.com/products/architect/
 *
 * This file requires use of the Sencha Touch 2.1.x library, under independent license.
 * License of Sencha Architect does not include license for Sencha Touch 2.1.x. For more
 * details see http://www.sencha.com/license or contact license@sencha.com.
 *
 * This file will be auto-generated each and everytime you save your project.
 *
 * Do NOT hand edit this file.
 */

Ext.define('MyApp.view.loginformpanel', {
    extend: 'Ext.form.Panel',

    config: {
        baseCls: 'fbloginpanel',
        id: 'loginformpanel',
        itemId: 'loginformpanel',
        layout: {
            type: 'vbox'
        },
        scrollable: {
            direction: 'vertical'
        },
        items: [
            {
                xtype: 'container',
                flex: 20,
                cls: 'fblogin',
                layout: {
                    type: 'vbox'
                },
                items: [
                    {
                        xtype: 'container',
                        flex: 3,
                        cls: 'wholepageRelative'
                    },
                    {
                        xtype: 'container',
                        flex: 18,
                        cls: 'wholepageRelative',
                        layout: {
                            type: 'vbox'
                        },
                        items: [
                            {
                                xtype: 'container',
                                flex: 8,
                                docked: 'top',
                                layout: {
                                    type: 'vbox'
                                },
                                items: [
                                    {
                                        xtype: 'fieldset',
                                        flex: 2,
                                        cls: 'loginmargin',
                                        docked: 'top',
                                        title: 'Existing User',
                                        items: [
                                            {
                                                xtype: 'emailfield',
                                                id: 'email1',
                                                itemId: 'email1',
                                                name: 'email1',
                                                placeHolder: 'Email'
                                            },
                                            {
                                                xtype: 'passwordfield',
                                                id: 'password1',
                                                itemId: 'password1',
                                                name: 'password1',
                                                placeHolder: 'Password'
                                            }
                                        ]
                                    },
                                    {
                                        xtype: 'button',
                                        flex: 1,
                                        cls: [
                                            'loginmargin',
                                            'Signbutton'
                                        ],
                                        docked: 'bottom',
                                        id: 'reglogin',
                                        itemId: 'reglogin',
                                        ui: 'round',
                                        icon: '',
                                        scope: this
                                    }
                                ]
                            },
                            {
                                xtype: 'container',
                                flex: 10,
                                layout: {
                                    type: 'vbox'
                                },
                                items: [
                                    {
                                        xtype: 'container',
                                        flex: 10,
                                        layout: {
                                            type: 'vbox'
                                        },
                                        items: [
                                            {
                                                xtype: 'fieldset',
                                                flex: 4,
                                                cls: 'loginmargin',
                                                docked: 'top',
                                                layout: {
                                                    type: 'vbox'
                                                },
                                                title: 'New User',
                                                items: [
                                                    {
                                                        xtype: 'textfield',
                                                        id: 'username',
                                                        itemId: 'username',
                                                        name: 'username',
                                                        placeHolder: 'Username'
                                                    },
                                                    {
                                                        xtype: 'passwordfield',
                                                        id: 'password',
                                                        itemId: 'password',
                                                        name: 'password',
                                                        placeHolder: 'Password'
                                                    },
                                                    {
                                                        xtype: 'emailfield',
                                                        id: 'email',
                                                        itemId: 'email',
                                                        name: 'email',
                                                        placeHolder: 'Email'
                                                    },
                                                    {
                                                        xtype: 'passwordfield',
                                                        hidden: true,
                                                        id: 'hashpassword',
                                                        itemId: 'hashpassword',
                                                        label: 'ססמא',
                                                        name: 'hashpassword'
                                                    },
                                                    {
                                                        xtype: 'numberfield',
                                                        hidden: true,
                                                        label: 'Field',
                                                        name: 'bfacebook'
                                                    },
                                                    {
                                                        xtype: 'numberfield',
                                                        hidden: true,
                                                        label: 'Field',
                                                        name: 'bregister'
                                                    }
                                                ]
                                            },
                                            {
                                                xtype: 'container',
                                                flex: 4,
                                                minHeight: 100,
                                                layout: {
                                                    type: 'vbox'
                                                },
                                                items: [
                                                    {
                                                        xtype: 'button',
                                                        cls: [
                                                            'loginmargin',
                                                            'Regbutton'
                                                        ],
                                                        docked: 'top',
                                                        id: 'regbtn',
                                                        itemId: 'regbtn',
                                                        ui: 'round',
                                                        icon: '',
                                                        scope: this
                                                    },
                                                    {
                                                        xtype: 'button',
                                                        cls: 'fbLoginbtn',
                                                        docked: 'bottom',
                                                        height: '',
                                                        id: 'fbloginbtn1',
                                                        itemId: 'fbloginbtn1',
                                                        ui: ''
                                                    }
                                                ]
                                            },
                                            {
                                                xtype: 'container',
                                                flex: 2,
                                                docked: 'bottom',
                                                height: 50
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            },
            {
                xtype: 'toolbar',
                cls: 'registerToolbar',
                docked: 'top',
                items: [
                    {
                        xtype: 'button',
                        baseCls: 'backbtn',
                        docked: 'left',
                        height: '',
                        id: 'loginbackbtn',
                        itemId: 'loginbackbtn',
                        width: '18%'
                    }
                ]
            }
        ],
        listeners: [
            {
                fn: 'onLoginbackbtnTap',
                event: 'tap',
                delegate: '#loginbackbtn'
            }
        ]
    },

    onLoginbackbtnTap: function(button, e, eOpts) {
        //var Screen = Ext.ComponentQuery.query('#fbloginpanel');

        Ext.Viewport.setActiveItem(Ext.ComponentQuery.query('#fbloginpanel')[0]);
        //Ext.Viewport.show();
    }

});

现在我在其他观点中有更多问题,甚至没有那些案例。

有人有类似的问题吗?请帮我。

4

1 回答 1

0

只是一个快速的猜测,但您没有在您发布的课程中使用“requires”关键字。

您的视图完全有可能无法在模拟器或设备上加载,因为应用程序在构建后不知道如何解析这些 xtype,因为“开发”和“生产”模式非常不同。

作为最佳实践,始终对您的类使用的每个依赖项使用“requires”。

于 2013-10-30T12:37:18.443 回答