Skip to content

Instantly share code, notes, and snippets.

@rborn
Forked from jasonkneen/index.js
Created June 9, 2014 12:21
Show Gist options
  • Save rborn/a5db006fb160989459f5 to your computer and use it in GitHub Desktop.
Save rborn/a5db006fb160989459f5 to your computer and use it in GitHub Desktop.
$.mySwitch.addEventListener('change',function(e){
Ti.API.info('Switch value: ' + $.mySwitch.value);
});
<Alloy>
<Window>
<Switch id="mySwitch" module="ui"/>
</Window>
</Alloy>
exports.createSwitch = function(args) {
if (OS_ANDROID) {
var RealSwitch = require("com.yydigital.realswitch");
return RealSwitch.createRealSwitch(args);
} else {
return Ti.UI.createSwitch(args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment