Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Adding Button to Tab Navbar

Hi,

I had a working application which opened up a modal window with a toolbar at the top that had a close button that would close the window. Well, I switched from that toolbar to a tabgroup toolbar, but now I can't show the cancel button on the toolbar.

Does anyone know how to do this?

I can't use window.rightNavButton = cancel; anymore right?

— asked September 1st 2010 by Connor Zwick
  • button
  • cancel
  • tabgroup
  • toolbar
1 Comment
  • I'd like to know the answer as well.

    — commented April 15th 2011 by Joe iEntry

1 Answer

  • Add Button to Tab Group Toolbar/Navbar

    I think this is what you are looking for. The code:

    var btnEdit = Ti.UI.createButton({
        systemButton: Ti.UI.iPhone.SystemButton.EDIT
    });
    btnEdit.addEventListener('click',function(e){
        // button was clicked
    });
    tabWin.rightNavButton = btnEdit;
    

    You can also add a left button by doing:

    tabWin.leftNavButton = btnEdit;
    

    Reading these two questions: one and two helped me figure this out.

    The buttons will then display like:

    http://i.imgur.com/EfrO4.png

    Note that this works for iPhones, not just iPads (haven't tested on Android). All the button options are listed here. Also, note that you can do similar things with the icons on the tab bar using these button styles.

    — answered April 15th 2011 by Joe iEntry
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.