Created
March 29, 2011 21:36
-
-
Save jonalter/893369 to your computer and use it in GitHub Desktop.
ScrollableView opening custom windows
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
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
var views = []; | |
for (var i = 0; i < 10; i++) { | |
var imgView = Ti.UI.createImageView({ | |
image: 'KS_nav_ui.png', | |
customData: i+1, | |
top: 0, left: 0, | |
width: 100, | |
height: 50 | |
}); | |
imgView.addEventListener('click', function(e){ | |
var dView = Ti.UI.createWindow({ | |
backgroundColor: 'yellow' | |
}); | |
var label = Ti.UI.createLabel({ | |
text: "View Number: ["+e.source.customData+"]", | |
height: 60, | |
width: 150, | |
top: 20 | |
}); | |
var closeButton = Ti.UI.createButton({ | |
title: 'Close', | |
height: 60, | |
width: 150, | |
bottom: 20 | |
}); | |
closeButton.addEventListener('click', function(e){ | |
dView.close(); | |
}); | |
dView.add(label); | |
dView.add(closeButton); | |
dView.open(); | |
}); | |
views.push(imgView); | |
} | |
win.add(Ti.UI.createScrollableView({ | |
views: views, | |
top: 0, right: 0, bottom: 0, left: 0 | |
})); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment