【发布时间】:2012-01-17 04:33:43
【问题描述】:
所以我正在编写一个应用程序,它会从网站 URL 中获取专辑封面。
到目前为止,基本上我的写作方式是读入一个文件,其中包含专辑插图的 URL。然后用文件中的数据构造一个二维 NSMutableArray,并从文件中的各个 URL 初始化 UIImages,然后存储在数组中。
然后将数组加载到 UITableView 中。
这很好用...除了加载应用程序需要 10 秒(哈哈)。
那么有什么方法可以在加载 UITableView 后加载图片?
如果有帮助,这是我的 cellForRowAtIndexPath 方法。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"identifier"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"identifier"]autorelease];
}
((UILabel *)[cell viewWithTag:artistTag]).text = [[musicList.list objectAtIndex:indexPath.row] objectAtIndex:artistIndex];
((UILabel *)[cell viewWithTag:albumTag]).text = [[musicList.list objectAtIndex:indexPath.row] objectAtIndex:albumIndex];
((UILabel *)[cell viewWithTag:dateTag]).text = [[musicList.list objectAtIndex:indexPath.row] objectAtIndex:dateIndex];
((UIImageView *)[cell viewWithTag:imageTag]).image = [[musicList.list objectAtIndex:indexPath.row] objectAtIndex:imageIndex];
return cell;
}
非常感谢!
【问题讨论】:
标签: iphone ios cocoa-touch uitableview uikit