Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make UIProgressView on the UITableViewCell change immediately?

I put a UIProgressView on a UITableViewCell, like that:

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"downloadcell"];
if(cell==nil)
{
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
                                 reuseIdentifier:@"downloadcell"] autorelease];
    UIProgressView* downPreView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
    downPreView.tag = 123;
    downPreView.frame = CGRectMake(400,70, 200,10);
    [cell.contentView addSubview:downPreView];
}

When download size have changed, I do that:

    UIProgressView* downPreView = (UIProgressView*)[cell viewWithTag:123];
downPreView.progress = downloadPre;

but the look of downPreView will not change immediately, only after I touch cell or other cell, so how to make UIProgressView on the UITableViewCell change immediately?

like image 594
Tinyfool Avatar asked Nov 06 '10 03:11

Tinyfool


1 Answers

performSelectorOnMainThread on it and everything is fine.

like image 199
Tinyfool Avatar answered Sep 29 '22 21:09

Tinyfool