2010-11-06 31 views
7

我把UIProgressView上一个UITableViewCell,像:如何使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立即改变?

回答

4

performSelectorOnMainThread就可以了,一切都很好。