所以我正在编写一个应用程序,它从网站网址中提取专辑图片。
基本上我到目前为止编写的是读入的文件,其中包含专辑图片的URL。然后使用文件中的数据构造二维NSMutableArray,并从文件中的各个URL初始化UIImages,然后将其存储在数组中。
然后将数组加载到UITableView。
这很有用......除了加载应用程序需要10秒钟(lol)。
加载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;
}
非常感谢!
答案 0 :(得分:0)
答案 1 :(得分:0)
答案 2 :(得分:0)
AFNetworking非常适合异步加载,甚至还带有处理图像加载的功能(例如,Album Artwork)。 github repo包含示例代码。