Skip to content

Instantly share code, notes, and snippets.

@pec1985
Created April 21, 2011 16:48
Show Gist options
  • Save pec1985/934960 to your computer and use it in GitHub Desktop.
Save pec1985/934960 to your computer and use it in GitHub Desktop.
toolbarCenterLabel.js
var win = Titanium.UI.createWindow({
top:0,
backgroundColor:'#ccc'
});
var toolbar = Ti.UI.createToolbar({
top:0
});
var b1 = Ti.UI.createButton({
title:'one',
style:1
});
var b2 = Ti.UI.createButton({
title:'two',
style:1
});
var b3 = Ti.UI.createButton({
title:'three',
style:1
});
var b4 = Ti.UI.createButton({
title:'four',
style:1
});
var flexSpace = Titanium.UI.createButton({
systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
});
var label = Ti.UI.createLabel({
text:'my title',
left:0,right:0,
top:0,bottom:0,
textAlign:'center'
});
toolbar.items = [b1,b2,flexSpace,b3,b4];
toolbar.add(label);
win.add(toolbar);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment