Created
May 25, 2010 20:56
-
-
Save rubysolo/413680 to your computer and use it in GitHub Desktop.
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
| // WINDOWS | |
| var masterWindow = Ti.UI.createWindow({ backgroundColor:'#ffffff', title: 'Root' }); | |
| var childWindow = Ti.UI.createWindow({ backgroundColor:'#ffffff', title: 'Child' }); | |
| // data for root table view | |
| var mainNavGroups = [ | |
| { title: "Foo" }, | |
| { title: "Bar" } | |
| ]; | |
| var masterRootNavTable = Titanium.UI.createTableView({ data: mainNavGroups }); | |
| masterRootNavTable.addEventListener('click', function(e) { | |
| switch(e.rowData.title) { | |
| case "Foo": | |
| masterNavGroup.open(childWindow); | |
| break; | |
| default: | |
| alert("TODO"); | |
| break; | |
| } | |
| }); | |
| masterWindow.add(masterRootNavTable); | |
| var masterNavGroup = Ti.UI.iPhone.createNavigationGroup({ | |
| window: masterWindow | |
| }); | |
| // child window | |
| masterNavGroup.open(childWindow); | |
| // LIST | |
| var childItems = [ | |
| { id: 1, title: "Item 1" }, | |
| { id: 1, title: "Item 2" }, | |
| { id: 1, title: "Item 3" }, | |
| { id: 1, title: "Item 4" } | |
| ]; | |
| var childTable = Titanium.UI.createTableView({ data:childItems }); | |
| childTable.addEventListener('click', function(e) { | |
| // do stuff with selected item | |
| }); | |
| childWindow.add(SplitViewPlain.childTable); | |
| // DETAIL | |
| var detailWindow = Ti.UI.createWindow({ backgroundColor:'#336699' }); | |
| var detailNavGroup = Ti.UI.iPhone.createNavigationGroup({ | |
| window: detailWindow | |
| }); | |
| // SPLIT VIEW | |
| var splitView = Titanium.UI.iPad.createSplitWindow({ | |
| masterView: masterNavGroup, | |
| detailView: detailNavGroup, | |
| }); | |
| splitView.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment