问题
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:
performSelectorOnMainThread on it and everything is fine.
来源:https://stackoverflow.com/questions/4111790/how-to-make-uiprogressview-on-the-uitableviewcell-change-immediately