2012-04-27 4 views
1

1.) Мне нужно добавить 2 кнопки, один под другим. Моя работа до сих пор показана ниже; Он показывает только одну кнопку, но как я могу добавить еще одну кнопку с другим изображением кнопки ниже этой кнопки?Добавление кнопки и перемещение между видами

2.) Когда пользователь нажимает кнопку, мне нужно перейти на другой экран. Как я могу это сделать ? Мне нужен эквивалент следующего кода объектива-c?

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

3.) Как я добавить навигационную панель (эквивалент панели навигации, показанной на iPhone)

Код для 1-й вопрос;

{ 
       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 
          } 

          }); 
         } 
        } 
       ] 

      } 
+0

похоже, что этот владелец вопроса должен принять правильный ответ, который является EARLIER. В этом случае M-x. –

ответ

1

1) Для получения двух кнопок один ниже другого, вы можете добавить две отдельные кнопки (с разной 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 Замечательно, но это очень продвинутый пример уровня & также трудно понять в первом экземпляре.

Вот easy solution от navigatioview от Sencha Docs.

//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(); 
            } 
           } 
          ] 
         }); 
        } 
       } 
      ] 
     } 
    ] 
}); 
1

Возможно, навигация будет работать для вас? Это та же идея, но это, как начиная с UITableView:

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

В приложение/контроллер/application.js, при нажатии на контакт, вид деталь получает толкнул. Весь источник находится в каталоге примеров.

 
    onContactSelect: function(list, index, node, record) { 
     var editButton = this.getEditButton(); 

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

     // Bind the record onto the show contact view 
     this.showContact.setRecord(record); 

     // Push the show contact view into the navigation view 
     this.getMain().push(this.showContact); 
    }, 

Смежные вопросы