Created
January 26, 2012 04:37
-
-
Save poutyface/1681025 to your computer and use it in GitHub Desktop.
Titanium Snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Window | |
// | |
// create window | |
var win = Ti.UI.createWindow({ | |
title:'window', | |
backgroundColor:'#fff' | |
}); | |
// get current window | |
win = Ti.UI.currentWindow; | |
// open window | |
win.open(); | |
// Using Tab, this is a smart way | |
Ti.UI.currentTab.open(win); | |
// close window | |
win.close(); | |
// | |
// Tab | |
// | |
var tabGroup = Ti.UI.createTabGroup(); | |
var tab = Ti.UI.createTab({ | |
title:'Tab', | |
window:win | |
}); | |
tabGroup.addTab(tab); | |
tabGroup.open(); | |
// | |
// Label | |
// | |
var Label = Ti.UI.createLabel({ | |
width: 120, | |
height: 12, | |
left: 58, | |
top: 5, | |
fontSize: 6, | |
fontWeight: 'bold', | |
color: '#2b4771' | |
}); | |
// | |
// TableView | |
// | |
var tableView = Ti.UI.createTableView({ | |
data:[] | |
}); | |
currentData = []; | |
tableView.setData(currentData); | |
// | |
// Button | |
// | |
var button = Ti.UI.createButton({ | |
top: 160, | |
left: 100, | |
width: 80, | |
height: 44, | |
title: 'button' | |
}); | |
// | |
// OptionDialog | |
// | |
var optionDialog = Ti.UI.createOptionDialog({ | |
options: ['option1', 'option2', 'cancel'], | |
cancel: 2, | |
title: 'option dialog' | |
}); | |
optionDialog.addEventListener('click', function(e){ | |
switch(e.index){ | |
case 0: | |
// option1(); | |
break; | |
case 1: | |
// option2(); | |
break; | |
} | |
}); | |
button.addEventListener('click', function(e){ | |
optionDialog.show(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment