Created
June 29, 2015 08:24
-
-
Save Velan/f3d75612a611b9a47568 to your computer and use it in GitHub Desktop.
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 Window = Ti.UI.createWindow(); | |
var WrapperView = Ti.UI.createView(); | |
var ListView = Ti.UI.createListView({ | |
top: 0, | |
left: 0, | |
defaultItemTemplate: 'test', | |
templates: { | |
test: { | |
properties: { | |
height: 100, | |
backgroundColor: '#ccc' | |
}, | |
childTemplates: [{ | |
type: 'Ti.UI.Button', | |
bindId: 'button', | |
properties: {}, | |
events: { | |
click: function(e) { | |
console.log('Click ', {x: e.x, y: e.y}); | |
console.log('Button title', e.source.getTitle()); | |
var point = e.source.convertPointToView({x: Math.round(e.x), y: Math.round(e.y)}, Window); | |
console.log('Converted', {x: point.x, y: point.y}); | |
} | |
} | |
}] | |
} | |
} | |
}); | |
var ListSection = Ti.UI.createListSection(); | |
ListSection.setItems([ | |
{button: {title: 'button 1'}}, | |
{button: {title: 'button 2'}}, | |
{button: {title: 'button 3'}}, | |
{button: {title: 'button 4'}}, | |
{button: {title: 'button 5'}}, | |
{button: {title: 'button 6'}}, | |
{button: {title: 'button 7'}}, | |
{button: {title: 'button 8'}}, | |
{button: {title: 'button 9'}} | |
]); | |
ListView.setSections([ListSection]); | |
WrapperView.add(ListView); | |
Window.add(WrapperView); | |
Window.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment