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?
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:
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.