Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UITableView加载应用程序后加载图像_Iphone_Ios_Cocoa Touch_Uitableview_Uikit - Fatal编程技术网

Iphone UITableView加载应用程序后加载图像

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

所以我在写一个应用程序,它从网站URL获取相册图片

基本上到目前为止我写的是一个文件被读入,其中包含相册插图的URL。然后,使用文件中的数据构造二维NSMutableArray,并从文件中的各个URL初始化UIImages,然后将其存储在数组中

然后将数组加载到UITableView中

这很有效。。。不过加载应用程序需要10秒(lol)

那么,一旦加载UITableView,是否有任何方法可以加载图像

这是我的CellForRowatineXpath方法,如果有用的话

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


非常感谢

原因很可能是因为图像检索阻塞了主线程。 使用此选项可以管理异步加载的图像


它包括如何使用它的示例

您真正想做的是在后台线程中加载图像

有关完整的相关代码套件,请查看


或者,对于异步查看代码,checkout

AFNetworking非常适合异步加载,甚至还提供了处理图像加载(例如,相册插图)的功能。 github repo包含示例代码