我在UITableViewCell上放了一个UIProgressView,就像那样:
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];
}
当下载大小发生变化时,我会这样做:
UIProgressView* downPreView = (UIProgressView*)[cell viewWithTag:123];
downPreView.progress = downloadPre;
但是只有在我触摸单元格或其他单元格之后,downPreView的外观才会立即改变,那么如何让UITableViewCell上的UIProgressView立即改变?
答案 0 :(得分:4)
performSelectorOnMainThread就可以了,一切都很好。