Skip to content

Instantly share code, notes, and snippets.

@rborn
Forked from jasonkneen/sample.js
Created May 13, 2014 17:02
Show Gist options
  • Save rborn/a658d2e51933236f1f11 to your computer and use it in GitHub Desktop.
Save rborn/a658d2e51933236f1f11 to your computer and use it in GitHub Desktop.
$.recordCount.value = 99
<Alloy>
<View class="container">
<DynamicLabel module="ui" id="recordCount" value="0" template="? Records"/>
</View>
</Alloy>
exports.createDynamicLabel = function(args) {
var label = Ti.UI.createLabel(args);
function updateText() {
label.text = label.template.replace("?", label.value);
}
label.getValue = function() {
return label.value;
};
label.setValue = function(value) {
label.value = value;
updateText();
};
updateText();
return label;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment