如何在ios中获取图像的日期,位置,大小和方向?

时间:2016-11-27 12:07:55

标签: ios objective-c image

当我点击照片库中的照片时,它会转到另一个带有xip的视图控制器并在xip中显示此图像。还有一个细节按钮。当按下细节按钮时,我想在该xip上显示所选图像的创建日期,位置大小,图像路径,相机信息和白平衡。

请帮助我如何在目标c中执行此操作。

1 个答案:

答案 0 :(得分:0)

不要忘记在构建阶段添加框架工作

#import <AssetsLibrary/AssetsLibrary.h>



- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

NSURL *refURL = [info valueForKey:UIImagePickerControllerReferenceURL];

 // define the block to call when we get the asset based on the url (below)
   ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *imageAsset)
{
ALAssetRepresentation *imageRep = [imageAsset defaultRepresentation];
NSLog(@"[imageRep filename] : %@", [imageRep filename]);
};

// get the asset library and fetch the asset based on the ref url (pass in block above)
ALAssetsLibrary* assetslibrary = [[ALAssetsLibrary alloc] init];
[assetslibrary assetForURL:refURL resultBlock:resultblock failureBlock:nil];

}