[英]How to get a NSDATE from UIImage?
How do i get a date or metadata from a UIImage in this case: 在这种情况下,如何从UIImage获取日期或元数据:
//UIImagePickerControllerSourceType
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
//delegate return
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
// po info in console -> there is no metadata of the image where i can find the date
// Has anyone an idea how to get it?
}
If you are referring to EXIF metadata in the image (which includes date information), you can see this question for information on how to access it: 如果您要引用图像中的EXIF元数据(包括日期信息),则可以看到此问题以获取有关如何访问它的信息:
How to access photo EXIF in pictures taken from camera in iOS 4.0+? 如何在iOS 4.0+中从相机拍摄的照片中访问照片EXIF?
The info dictionary contains a key called "UIImagePickerControllerMediaMetadata" which is another dictionary. 信息词典包含另一个名为“ UIImagePickerControllerMediaMetadata”的键。 Just NSLog allKeys of that to get the date key. 只需NSLog的allKeys即可获取日期密钥。
NSDictionary *metadata = [info objectForKey: UIImagePickerControllerMediaMetadata];
NSLog(@"%@",metadata);
Choose what you need from metadata. 从元数据中选择所需的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.