Skip to content

Instantly share code, notes, and snippets.

@jhaynie
Created June 15, 2010 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhaynie/438522 to your computer and use it in GitHub Desktop.
Save jhaynie/438522 to your computer and use it in GitHub Desktop.
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({
title:"Test"
});
var win2 = Ti.UI.createWindow({
title:"Blank"
});
var tab1 = Ti.UI.createTab({
window:win1,
title:"Test"
});
var tab2 = Ti.UI.createTab({
window:win2,
title:"Blank"
});
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
var button = Ti.UI.createButton({
title:"Open",
width:80,
height:40
});
win1.add(button);
button.addEventListener('click',function()
{
try
{
// by default the modal window has a nav bar
// since we're embedding a navgroup inside the modal
// window which also has a nav bar, we ask him to hide it
var modal = Ti.UI.createWindow({
navBarHidden:true
});
var modalWin = Ti.UI.createWindow({
backgroundColor:"red"
});
var table = Ti.UI.createTableView({
style:Ti.UI.iPhone.TableViewStyle.GROUPED,
data:[{title:"Well look at this"},{title:"TweetDeck is cool"}]
});
modalWin.add(table);
var done = Titanium.UI.createButton({
systemButton:Titanium.UI.iPhone.SystemButton.DONE
});
modalWin.setRightNavButton(done);
done.addEventListener('click',function()
{
modal.close();
});
var nav = Ti.UI.iPhone.createNavigationGroup({
window:modalWin
});
table.addEventListener('click',function(e)
{
var w = Ti.UI.createWindow({
title:e.rowData.title
});
nav.open(w);
});
modal.add(nav);
modal.open({modal:true});
}
catch (E)
{
Ti.API.error("ERROR " +E);
}
});
tabGroup.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment