Highlighting a imageview inside TableViewRow?

You must Login before you can answer or comment on any questions.

Hi, I need to change the label colors & imageview background inside a tableviewRow. using Highlighted Color property able to do on labels on table view row. How to do the same on imageview inside tableviewRow?

  • Have to change the backgroundImage of the imageview on row selection and revert back to the previous image if the row is not currently selected

ie highlighted property for imageview inside tableview row.

How to achieve this? pls help me out with a sample

1 Answer

You should be able to change the image by setting the leftImage property on the row. You'll have to keep track of the previously selected row so you can change it back to what it was. Something like this:

var tv = Ti.UI.createTableView ({...});
 
var last_selected_row = null;
 
tv.addEventListener ('click', function (e) {
    if (last_selected_row != null)
    {
        last_selected_row.leftImage = '/images/normal.png';
    }
    e.row.leftImage = '/images/highlighted.png';
 
    last_selected_row = e.row;
});

Your Answer

Think you can help? Login to answer this question!