Adding Button to Tab Navbar

You must Login before you can answer or comment on any questions.

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 3 years ago by Connor Zwick
1 Comment
  • I'd like to know the answer as well.

    — commented 2 years ago 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.

Your Answer

Think you can help? Login to answer this question!