我正在使用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) 我已成功将元数据添加到应用程序中创建的jpg,并使用.将其保存到相机胶卷
writeImageToSavedPhotosAlbum: metadata: completionBlock:
Run Code Online (Sandbox Code Playgroud)
方法.但是,我还想选择通过电子邮件向这个jpg发送元数据(例如位置,退出等).我用它来发邮件:
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
NSData *myData = UIImageJPEGRepresentation(emailImage, 0.8);
[picker addAttachmentData:myData mimeType:@"image/jpg" fileName:@"photo"];
Run Code Online (Sandbox Code Playgroud)
但是,这不会导致元数据.
当通过Apple的照片应用程序发送保存的图像时,会包含元数据.有没有办法将元数据嵌入NSData附件?有任何想法吗?