Search code examples
androidtitaniumappceleratorappcelerator-mobiletitanium-mobile

Appcelerator leftImage


I'm trying to make my first mobile app using Appcelerator. When i try to load a local image into the array using "leftImage", the image doesn't show. However when i change the path to something that doesn't exist it tells me it can't find the path. I've googled it a lot and can't seem to find what i did wrong. Any help please?

var win1 = Titanium.UI.createWindow(
    {
        title:'test',
        className:'win1',
        backgroundColor:'#000000'
    }
);

var vdata = [
        {leftImage:'appicons/cloudy.gif',title:"Schedule"},
        {leftImage:'appicons/shows.png',height:60, title:"Shows"},
        {leftImage:'appicons/search.png', title:"Search"},
        {leftImage:'appicons/friends.png',title:"Friends"},
        {leftImage:'appicons/settings.png',title:"Settings"}
    ];

var table1 = Titanium.UI.createTableView({
    data:vdata
});
win1.add(table1);
win1.open();

Solution

  • leftImage is the property of Titanium.UI.TableViewRow

    So, you should use this:

    var row = Titanium.UI.createTableViewRow({leftImage:'appicons/cloudy.gif',title:"Schedule"});
    
    var table1 = Titanium.UI.createTableView({
        data:row
    });
    win1.add(table1);