Titanium appcelerator navigation group example
This is a little example about to build a navigation group (navigation controller for iOS)
var first = Ti.UI.createWindow({
backgroundColor:“#fff”,
title:“Nav Group”
});
var button1 = Ti.UI.createButton({title:‘push me Im the button number ONE!!!!!’, width:200, height:100});
var button2 = Ti.UI.createButton({title:‘push me Im the button number TWO!!!!!’, width:200, height:100});
var navGroup = Ti.UI.iPhone.createNavigationGroup({
window:first
});
var second = Ti.UI.createWindow({
background:“#fff”,
title:“The Child Window”
});
var third = Ti.UI.createWindow({
background:“red”,
title:“grandson win XD”
})
//let’s link the buttons on the windows!!
first.add(button1);
second.add(button2);
button1.addEventListener(“click”, function(e){
navGroup.open(second);
});
button2.addEventListener(“click”, function(e){
navGroup.open(third);
});
second.addEventListener(“open”, function(e){
Ti.API.info(‘lets open the win2’);
});
//and there’s a swipe catch on the second win ;)
second.addEventListener(“swipe”, function(e){
Ti.API.info(“Swipe detected dude!!!!!”);
})
//Main window of the app
var main = Ti.UI.createWindow();
main.add(navGroup);
main.open();