ShowTable of Contents
A bar with buttons that can be placed anywhere in the view.
Creation
App.buttonbar = Titanium.UI.createButtonBar({
labels:[{title:'Button 1', enabled:false}, 'Button 2', 'Button 3'],
backgroundColor:'#336699',
top:0,
style:Ti.UI.iPhone.SystemButtonStyle.PLAIN,
height:25,
width:500
});
Use the "style" attribut with:
Ti.UI.iPhone.SystemButtonStyle.PLAIN
Ti.UI.iPhone.SystemButtonStyle.BAR
Ti.UI.iPhone.SystemButtonStyle.BORDERED
Ti.UI.iPhone.SystemButtonStyle.DONE
Using images in the buttons:
App.buttonbar = Titanium.UI.createButtonBar({
labels:[{image:'button1.png', enabled:false},{image:'button2.png', enabled:true} ],
backgroundColor: '#b2b5ba',
top:0,
style:Titanium.UI.iPhone.SystemButtonStyle.BAR,
height:30,
width:140
});
Click event
App.topButtonBar.addEventListener('click', function(e) {
// pressed button is stored in e.index
// 0 = first button, 1 = second button and so on
});