Created
April 4, 2012 14:21
-
-
Save patrickseda/2301525 to your computer and use it in GitHub Desktop.
Sample of iOS/MobileWeb NavigationGroup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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