Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created February 8, 2012 00:07
Show Gist options
  • Save kwhinnery/1763217 to your computer and use it in GitHub Desktop.
Save kwhinnery/1763217 to your computer and use it in GitHub Desktop.
var window = Ti.UI.createWindow({
backgroundColor:'white'
});
var scroller = Ti.UI.createScrollView({
top:60,
contentHeight:'auto'
});
window.add(scroller);
var container = Ti.UI.createView({
layout:'vertical',
height:'auto',
top:0
});
scroller.add(container);
var button = Ti.UI.createButton({
top:5,
width:150,
height:50,
title:'Add content'
});
window.add(button);
var counter = 0;
function addContent() {
var dynamicContent = Ti.UI.createView({
height:50,
top:5,
left:5,
right:5,
backgroundColor:(counter % 2) ? 'red' : 'green'
});
container.add(dynamicContent);
counter++;
}
button.addEventListener('click', addContent);
window.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment