Skip to content

Instantly share code, notes, and snippets.

@jmwhittaker
Created June 15, 2010 08:27
Show Gist options
  • Save jmwhittaker/438845 to your computer and use it in GitHub Desktop.
Save jmwhittaker/438845 to your computer and use it in GitHub Desktop.
/*
This shows a bug where trying to programatically close a window in a navigationGroup fails
*/
//Here's the first window...
var first = Ti.UI.createWindow({
backgroundColor:"#fff",
title:"My App"
});
var label = Ti.UI.createLabel({ text: "poke me to open the next window" });
first.add(label);
//Here's the nav group that will hold them both...
var navGroup = Ti.UI.iPhone.createNavigationGroup({
window:first
});
//Here's a window we want to push onto the stack...
var second = Ti.UI.createWindow({
background:"#fff",
title:"Child Window"
});
second.add(Ti.UI.createLabel({text:"Here's the child"}));
//Add a done button to the right nav bar
var done = Titanium.UI.createButton({
systemButton:Titanium.UI.iPhone.SystemButton.DONE
});
second.setRightNavButton(done);
done.addEventListener('click',function()
{
navGroup.close(second);
Ti.API.info('Done / button hit');
});
//When the label on the first window receives a touch, open the second
label.addEventListener("click", function(e) {
navGroup.open(second);
});
//This is the main window of the application
var main = Ti.UI.createWindow();
main.add(navGroup);
main.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment