【发布时间】:2009-04-30 05:11:07
【问题描述】:
以下是在与我的应用程序主线程不同的线程中运行的代码块。如何在每个按钮获取缩略图后更新 UI?现在它不会更新,直到整个方法完成。按钮已添加到 UIScrollView。
(LotsGridButton 只是一个带有一些额外属性的 UIButton。)
- (void)fetchThumbnails {
CCServer* server = [[CCServer alloc] init];
for (int i=0; i<[buttons count]; i++) {
LotsGridButton* button = [buttons objectAtIndex:i];
if (button.lot.thumbnail) continue;
// load the thumbnail image from the server
button.lot.thumbnail = [server imageWithPath:button.lot.thumbnailURL];
[button setImage:button.lot.thumbnail forState:UIControlStateNormal];
}
[server release];
}
【问题讨论】:
标签: iphone objective-c cocoa-touch