-
-
Save iArnaud/600b7973096df267818c to your computer and use it in GitHub Desktop.
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
function collapse(){ | |
$.myView.collapse(); | |
// $.myView.expand(); | |
} |
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
<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 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