Skip to content

Instantly share code, notes, and snippets.

@noahd1 noahd1/app.js
Created Mar 17, 2010

Embed
What would you like to do?
Titanium.UI.setBackgroundColor('#000');
var tabGroup = Titanium.UI.createTabGroup();
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
var label2 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'}
});
win2.add(label2);
var button = Titanium.UI.createButton({
title:'I am a Button',
height:40,
width:200,
top:10
});
// create table view data object
var data = [
{title:'Row 1'},
{title:'Row 2'},
{title:'Row 3'}
];
// create table view
var tableview = Titanium.UI.createTableView({
data:data
});
var alert = Titanium.UI.createAlertDialog({
title: 'Timeout fired!',
message: ''
});
var doAfterMove = function() {
alert.show();
};
var timeout = null;
tableview.addEventListener('move',function(e)
{
if (timeout) {
clearTimeout(timeout);
}
timeout = setTimeout(doAfterMove, 20000);
});
// add table view to the window
win2.add(tableview);
//
// create edit/cancel buttons for nav bar
//
var edit = Titanium.UI.createButton({
title:'Move'
});
edit.addEventListener('click', function()
{
win2.setRightNavButton(cancel);
tableview.moving = true;
});
var cancel = Titanium.UI.createButton({
title:'Cancel',
style:Titanium.UI.iPhone.SystemButtonStyle.DONE
});
cancel.addEventListener('click', function()
{
win2.setRightNavButton(edit);
tableview.moving = false;
});
win2.setRightNavButton(edit);
tabGroup.addTab(tab2);
// open tab group
tabGroup.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.