0
我正在創建一些imageViews,如下所示。如何在appcelerator中監聽圖像組中的單擊事件
// Time buttons
var timeButtons =[
{ title: 'Afternoon', path: 'images/others/time/afternoon.png'},
{ title: 'CurrentTime', path: 'images/others/time/currenttime.png'},
{ title: 'Evening', path: 'images/others/time/evening.png'}
]
createButtons(timeButtons);
/* Button creation function */
function createButtons(data){
for (var i = 0; i < data.length; i++){
//Creating each button
var button = Titanium.UI.createImageView({
image: data[i].path,
height: 90,
width: 90,
top: 20+90*i+20*i,
value: 1
});
//Adding the buttons to the center view
centerButtons.add(button);
}
}
現在,當用戶點擊任何一個ImageView的,我要確定哪些ImageView的點擊它,並做相應的事情。