Skip to content

Instantly share code, notes, and snippets.

@hansemannn
Created May 14, 2016 22:04
Show Gist options
  • Save hansemannn/6d2c919c7e584130dd1dea37b68da38f to your computer and use it in GitHub Desktop.
Save hansemannn/6d2c919c7e584130dd1dea37b68da38f to your computer and use it in GitHub Desktop.
var win = Titanium.UI.createWindow({
title: 'Tab 1',
backgroundColor: '#fff',
layout: "vertical"
});
// Create a Button.
var save = Ti.UI.createButton({
title: 'save',
height: Ti.UI.SIZE,
width: Ti.UI.SIZE,
top: 30,
});
// Listen for click events.
save.addEventListener('click', function(e) {
alert('touchEnabled = ' + (e.source.touchEnabled));
});
// Create a Label.
var testlabel = Ti.UI.createLabel({
text: 'testlabel',
color: '#000',
font: {
fontSize: 40
},
height: Ti.UI.SIZE,
width: Ti.UI.SIZE,
top: 50,
});
// Listen for click events.
testlabel.addEventListener('click', function(e) {
alert('touchEnabled = ' + (e.source.touchEnabled));
});
// Add to the parent view.
var view = Ti.UI.createView({
width: 100,
height: 50,
backgroundColor: 'red',
top: 20
});
// Listen for click events.
view.addEventListener('click', function(e) {
alert('touchEnabled = ' + e.source.touchEnabled);
});
// Add to the parent view.
win.add(testlabel);
win.add(view);
win.add(save);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment