1

1.) 上下に 2 つのボタンを追加する必要があります。これまでの作業を以下に示します。ボタンは 1 つしか表示されませんが、このボタンの下に別のボタン イメージを持つ別のボタンを追加するにはどうすればよいですか?

2.) ユーザーがボタンをクリックすると、別の画面に移動する必要があります。これどうやってするの ?次の Objective-C コードに相当するものが必要ですか?

View1 *view1 = [[View1 alloc] initWithNibName:@"View1" bundle:nil];
            [self.navigationController pushViewController:View1 animated:YES];

3.) ナビゲーション バーを追加するにはどうすればよいですか (iPhone に表示されるナビゲーション バーに相当)

最初の質問のコード。

{
                items:[
                    {
                        xtype:'button',
                        text: 'Submit',
                        ui:'confirm',
                        handler: function(){
                          var values = Ext.getCmp('contactForm').getValues();

                          Ext.Ajax.request({

                            url: 'http://loonghd.com/service/',

                            failure: function (response) {
 //do something
            },                              success: function (response) {
                                                                         // do something
                            }

                           });
                        }
                    }
                ]

            }
4

2 に答える 2

1

1) 2 つのボタンを上下に配置するには、フォーム パネルの子として 2 つの別個のボタン (異なる UI プロパティを持つ) を追加できます。これが必要だと思います。

ちょうどこのような、

   ....
   ....
   items : [
       {
         xtype:'button',
         text: 'Submit',
         ui:'confirm', // makes the button color as green
         handler: function(){
            var values = Ext.getCmp('contactForm').getValues();
            Ext.Ajax.request({
                 url: 'http://loonghd.com/service/',
                 failure: function (response) {
                        //do something
                  },

                 success: function (response) {
                         // do something
                 }
            });
           }
          },
          {
              xtype:'button',
              text:'Second button',
              ui:'decline', // makes the button color as red.
              listeners : {
                  tap : function() {
                     Ext.Msg.alert('You just clicked Second button');
                  }
               } 
           } 
  ]
  ....
  ....

2) 3) 2 番目と 3 番目の質問についてnavigationviewは、解決策です。によって投稿されたソリューションM-xは素晴らしいですが、非常に高度なレベルの例であり、最初は理解するのも困難です。

これは、Sencha Docs からの簡単な解決策です。navigatioview

//create the navigation view and add it into the Ext.Viewport
var view = Ext.Viewport.add({
    xtype: 'navigationview',

    //we only give it one item by default, which will be the only item in the 'stack' when it loads
    items: [
        {
            //items can have titles
            title: 'Navigation View',
            padding: 10,

            //inside this first item we are going to add a button
            items: [
                {
                    xtype: 'button',
                    text: 'Push another view!',
                    handler: function() {
                        //when someone taps this button, it will push another view into stack
                        view.push({
                            //this one also has a title
                            title: 'Second View',
                            padding: 10,

                            //once again, this view has one button
                            items: [
                                {
                                    xtype: 'button',
                                    text: 'Pop this view!',
                                    handler: function() {
                                        //and when you press this button, it will pop the current view (this) out of the stack
                                        view.pop();
                                    }
                                }
                            ]
                        });
                    }
                }
            ]
        }
    ]
});
于 2012-04-27T18:45:46.233 に答える
1

多分ナビゲーションビューがあなたのために働くでしょうか?同じ考え方ですが、UITableView から始めるのと似ています。

http://docs.sencha.com/touch/2-0/#!/example/navigation-view

app/controller/Application.js で連絡先をタップすると、詳細ビ​​ューがプッシュされます。すべてのソースは、examples ディレクトリにあります。

    onContactSelect: 関数(リスト、インデックス、ノード、レコード) {
        var editButton = this.getEditButton();

        if (!this.showContact) {
            this.showContact = Ext.create('AddressBook.view.contact.Show');
        }

        // レコードを show contact ビューにバインドします
        this.showContact.setRecord(レコード);

        // show contact ビューをナビゲーション ビューにプッシュします
        this.getMain().push(this.showContact);
    }、

于 2012-04-27T18:32:03.757 に答える