Created
May 21, 2012 10:46
-
-
Save hdogan/2761781 to your computer and use it in GitHub Desktop.
Titanium Mobile - iPad SplitWindow with NavigationGroup on Detail View and TabGroup on Master View
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
Ti.UI.setBackgroundColor('#fff'); | |
/** | |
* Master view with tabGroup. | |
*/ | |
var winMaster = Ti.UI.createWindow(); | |
var tabGroup = Ti.UI.createTabGroup(); | |
var winTab1 = Ti.UI.createWindow(); | |
var winTab2 = Ti.UI.createWindow(); | |
var tab1 = Ti.UI.createTab({ | |
title: 'Tab 1', | |
window: winTab1 | |
}); | |
var tab2 = Ti.UI.createTab({ | |
title: 'Tab 2', | |
window: winTab2 | |
}); | |
tabGroup.addTab(tab1); | |
tabGroup.addTab(tab2); | |
winMaster.add(tabGroup); | |
tabGroup.open(); | |
/** | |
* Details view with navigationGroup. | |
*/ | |
var winDetail = Ti.UI.createWindow(); | |
var navDetail = Ti.UI.iPhone.createNavigationGroup({ | |
window: winDetail | |
}); | |
var splitWindow = Ti.UI.iPad.createSplitWindow({ | |
masterView: winMaster, | |
detailView: navDetail | |
}); | |
/** | |
* Popover menu. | |
*/ | |
splitWindow.addEventListener('visible', function(e) { | |
if (e.view == 'detail') { | |
e.button.title = 'Menu'; | |
winDetail.setLeftNavButton(e.button); | |
} | |
else if (e.view == 'master') { | |
winDetail.setLeftNavButton(null); | |
} | |
}); | |
splitWindow.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment