Skip to content

Instantly share code, notes, and snippets.

@meeech
Created September 8, 2012 05:26
Show Gist options
  • Save meeech/3672077 to your computer and use it in GitHub Desktop.
Save meeech/3672077 to your computer and use it in GitHub Desktop.
//Some example code on how to make a menu item type app.
var tray = Ti.UI.addTray('tray.png'),
menu = Ti.UI.createMenu(),
//Add some menu items
menuItems = [
Titanium.UI.createMenuItem('Change Icon', function() {
//Something's going on... let's change the icon.
tray.setIcon('tray-active.png');
setTimeout(function() {
tray.setIcon('tray.png');
}, 3000);
}),
Titanium.UI.createMenuItem('Cat', function(e) {
//Notification
alert('Meow Meow');
}),
Titanium.UI.createMenuItem('Quit', function() {
confirm('You sure?', function() {
Ti.App.exit();
});
})
];
menuItems.forEach(function(item) {
menu.appendItem(item);
});
tray.setMenu(menu);
//@broken in 1.2 sdk :(
// Titanium.UI.getCurrentWindow().showInspector(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment