how to make UIProgressView on the UITableViewCell

2019-03-28 06:10发布

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?

1条回答
唯我独甜
2楼-- · 2019-03-28 06:42

performSelectorOnMainThread on it and everything is fine.

查看更多
登录 后发表回答