Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

iOS activity indicator on tableview row strange behavior

$
0
0

What I am trying to achieve is to attach an activity indicator on each row of a tableview. The data for each row originate from a remote service so I would like to show which rows are "ready" and which are not.

Also when the activity indicator is still shown I would like to disable clicking on the rows because when clicked they open a details page which I would not like to show because at this point not all data necessary are available.

What I have done is marking the row as "disabled" when the activity indicator is shown. This works fine if clicking anywhere except right on the "flashing" indicator symbol. Then the marker I have added seems to be bypassed and the details window opens.

I provide a simplified snippet of code to clarify this. Try clicking on the activity indicator itself and on its background color. It does not behave as the same view...

var tabledata = [{title:'row1'}, {title:'row2'}, {title:'row3'}, {title:'row4'}];
 
 
var self = Ti.UI.createWindow({
    backgroundColor:'black',
});
 
var tableview = Ti.UI.createTableView({
    width:240, height:Ti.UI.SIZE,
    top:60, bottom:60,
    backgroundColor:'transparent',
    separatorStyle: Ti.UI.iPhone.TableViewSeparatorStyle.NONE,
});
 
tableview.addEventListener('click', function(e){
    if (e.source.type != 'disabled')
    {
        alert('opening new page...');
        //alert('type clicked: ' + e.source.type);
    }
});
 
function createTableViewRow(i)
{
    var row = Ti.UI.createTableViewRow({
        width:240, height:50,
        selectionStyle: Ti.UI.iPhone.TableViewCellSelectionStyle.GRAY,
        backgroundColor:'white',
        title: tabledata[i].title
    });
 
    var actInd = Ti.UI.createActivityIndicator({
        backgroundColor:'blue', opacity:0.2,
        color:'#fff',
        style:Ti.UI.iPhone.ActivityIndicatorStyle.BIG,
        top:0, bottom:0, left:0, right:0,
        zIndex:1000,
        type:'disabled'
    });
    row.add(actInd);
    (i%2==0) ? actInd.show() : actInd.hide();
 
    return row;
}
 
function populateTable()
{
    var data = [];
 
    for (var i=0; i<tabledata.length; i++)
    {
        var row = createTableViewRow(i);        
        data.push(row);
    }
 
    tableview.setData([]);
    tableview.setData(data);
}
populateTable();
 
self.add(tableview);
self.open();
Do you think this could be a jira-related issue? Thanks in advance for any opinion on this.

Application type: mobile Platform: iOS Titanium SDK: 3.2.3.GA Device: iPhone simulator, iPad mini Host Operating System: OSX 10.8.5 Titanium Studio: build 3.2.3.201404181442


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>