2010-11-06 28 views
7

tôi đặt một UIProgressView trên UITableViewCell, như thế:cách tạo UIProgressView trên thay đổi UITableViewCell ngay lập tức?

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]; 
} 

Khi Dung lượng file download đã thay đổi, tôi làm điều đó:

UIProgressView* downPreView = (UIProgressView*)[cell viewWithTag:123]; 
downPreView.progress = downloadPre; 

nhưng giao diện của downPreView sẽ không thay đổi ngay lập tức, chỉ sau khi tôi chạm vào ô hoặc ô khác, vậy làm sao để UIProgressView thay đổi UITableViewCell ngay lập tức?

Trả lời

4

performSelectorOnMainThread on it and everything is fine.

Các vấn đề liên quan