Created
May 15, 2014 14:45
-
-
Save jasonkneen/bc936540ae9fedc8fa2b to your computer and use it in GitHub Desktop.
Demonstrate CollapsableView Tag in Alloy.
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
function collapse(){ | |
$.myView.collapse(); | |
// $.myView.expand(); | |
} |
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
<Alloy> | |
<CollapsableView module="ui" id="myView" height="200" width="Ti.UI.FILL" layout="vertical"> | |
<Label top="20">Hello there</Label> | |
<Button top="20" onClick="collapse">Collapse Me</Button> | |
</CollapsableView> | |
</Alloy> |
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
// put in the lib folder | |
exports.createCollapsableView = function(args) { | |
var view = Ti.UI.createView(args); | |
view.collapse = function() { | |
view.expandedHeight = view.expandedHeight || view.height; | |
view.height = 0; | |
}; | |
view.expand = function() { | |
view.height = view.expandedHeight; | |
}; | |
return view; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment