Hey!
I have a tableView where the rows have multiple labels. Because of this, the labels do not change color upon row selection. To achieve this, I'm trying to manually listen for touchstart and touchend events, but I'm not able to register them on the tableView, only ever on the window.
Some test code:
var currentWin = Ti.UI.currentWindow; var row = Ti.UI.createTableViewRow({ title: 'test', touchEnabled: true }); row.addEventListener('touchstart', function(e){ Ti.API.debug(['row touchstart', e]); }); var tableView = Ti.UI.createTableView({ data: [ row, { title: 'test2' }], top: 50, touchEnabled: true }); tableView.addEventListener('touchstart', function(e){ Ti.API.debug(['tablewview touchstart', e]); }); currentWin.addEventListener('touchstart', function(e){ Ti.API.debug(['window touchstart', e]); }); currentWin.add(tableView);Only the
window touchstart is possible to trigger.
Is this a known bug, or am I doing something wrong?
Thanks in advance /Jacob
2 Answers
Accepted Answer
Try setting the highlightedColor property of each label to #FFFFFF. :)
(I think the answer to your other question might be that the window needs to have its touchEnabled property set to false, so that it forwards events to its subviews.)
Hi James! That solved it - I hade totally missed the highlightedColor property :S Thanks a lot!
Though I have still no luck catching touchstart events, but in this case I don't need them anymore anyway!
/Jacob
Your Answer
Think you can help? Login to answer this question!