Created
July 27, 2014 20:06
-
-
Save TheBrousse/0479fdb7ab749945c8b3 to your computer and use it in GitHub Desktop.
nappDrawer on Android
This file contains 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
exports.SwapView = function(controllerToShow) { | |
// Remove the controllers.view from centerWindow | |
if (OS_ANDROID) { | |
Alloy.Globals.navbar.remove(Alloy.Globals.centerView.getView()); | |
// Destroy the old controller | |
Alloy.Globals.centerView.destroy(); | |
Alloy.Globals.centerView = null; | |
Ti.API.debug('SwapView.centerView: ' + Alloy.Globals.centerView); | |
} | |
// Assign the new controller | |
Alloy.Globals.centerView = controllerToShow; | |
Ti.API.debug('SwapView.centerView.controller: /' + Alloy.Globals.centerView.__controllerPath); | |
// Add the controller's view to our centerWindow | |
if (OS_ANDROID) { | |
Alloy.Globals.drawer.setCenterWindow(Alloy.Globals.centerView.getView()); | |
} else { | |
Alloy.Globals.navbar.openWindow(Alloy.Globals.centerView.getView(), { | |
animated: true | |
}); | |
} | |
if (Alloy.Globals.drawer.isLeftWindowOpen()) { | |
Alloy.Globals.drawer.toggleLeftWindow(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment