7

我将 UIProgressView 放在 UITableViewCell 上,如下所示:

    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

1 回答 1

4

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

于 2010-11-06T04:21:38.343 回答