Skip to content

Instantly share code, notes, and snippets.

@patrickseda
Created April 4, 2012 14:21
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 patrickseda/2301525 to your computer and use it in GitHub Desktop.
Save patrickseda/2301525 to your computer and use it in GitHub Desktop.
Sample of iOS/MobileWeb NavigationGroup.
/**
* Sample app.js to demonstrate cross-platform NavigationGroup on iOS & MobileWeb.
*/
var mainWin = Ti.UI.createWindow();
var win2 = Ti.UI.createWindow({
exitOnClose : true,
backgroundColor : '#a68',
title : 'Window2',
layout : 'vertical'
});
var textField = Ti.UI.createTextField({
top : 40, left : 10, width : 300, height : 40,
hintText : '...',
borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED
});
win2.add(textField);
var win1 = Ti.UI.createWindow({
exitOnClose : true,
backgroundColor : '#6a8',
title : 'Window1'
});
var button = Ti.UI.createButton({
height : 40,
width : 100,
top: 40,
title : 'Next'
});
button.addEventListener('click', function(e) {
navGroup.open(win2);
});
win1.add(button);
var navGroup;
if (Ti.Platform.osname === 'iphone') {
navGroup = Ti.UI.iPhone.createNavigationGroup({
window : win1
});
} else {
navGroup = Ti.UI.MobileWeb.createNavigationGroup({
window : win1
});
}
mainWin.add(navGroup);
mainWin.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment