相关疑难解决方法(0)

显示从iPhone中的ALAsset检索到的URL中的图像

我正在使用ALAsset Framework访问设备照片库中的文件.

到目前为止,我可以访问缩略图并显示它.
我想在图像视图中显示实际图像,但我无法弄清楚如何执行此操作.

我尝试使用ALAsset对象中的URL字段但未成功.

谁知道如何做到这一点?

这是我能够访问缩略图并将其放在表格单元格中的一些代码:

- (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath {


  static NSString *CellIdentifier = @"Cell";

  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
  }
  //here 'asset' represents the ALAsset object


  asset = [assets objectAtIndex:indexPath.row];
       //i am accessing the thumbnail here
  [cell.imageView setImage:[UIImage imageWithCGImage:[asset thumbnail]]];
  [cell.textLabel setText:[NSString stringWithFormat:@"Photo %d", indexPath.row+1]];

  return cell;
}
Run Code Online (Sandbox Code Playgroud)

iphone url image

66
推荐指数
4
解决办法
8万
查看次数

标签 统计

image ×1

iphone ×1

url ×1