Iphone UITableView加载应用程序后加载图像
所以我在写一个应用程序,它从网站URL获取相册图片 基本上到目前为止我写的是一个文件被读入,其中包含相册插图的URL。然后,使用文件中的数据构造二维NSMutableArray,并从文件中的各个URL初始化UIImages,然后将其存储在数组中 然后将数组加载到UITableView中 这很有效。。。不过加载应用程序需要10秒(lol) 那么,一旦加载UITableView,是否有任何方法可以加载图像 这是我的CellForRowatineXpath方法,如果有用的话Iphone UITableView加载应用程序后加载图像,iphone,ios,cocoa-touch,uitableview,uikit,Iphone,Ios,Cocoa Touch,Uitableview,Uikit,所以我在写一个应用程序,它从网站URL获取相册图片 基本上到目前为止我写的是一个文件被读入,其中包含相册插图的URL。然后,使用文件中的数据构造二维NSMutableArray,并从文件中的各个URL初始化UIImages,然后将其存储在数组中 然后将数组加载到UITableView中 这很有效。。。不过加载应用程序需要10秒(lol) 那么,一旦加载UITableView,是否有任何方法可以加载图像 这是我的CellForRowatineXpath方法,如果有用的话 - (UITableVie
- (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;
}
非常感谢 原因很可能是因为图像检索阻塞了主线程。 使用此选项可以管理异步加载的图像
它包括如何使用它的示例您真正想做的是在后台线程中加载图像 有关完整的相关代码套件,请查看
或者,对于异步查看代码,checkoutAFNetworking非常适合异步加载,甚至还提供了处理图像加载(例如,相册插图)的功能。 github repo包含示例代码