簡體   English   中英

如何從UIImage獲取NSDATE?

[英]How to get a NSDATE from UIImage?

在這種情況下,如何從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?

}

如果您要引用圖像中的EXIF元數據(包括日期信息),則可以看到此問題以獲取有關如何訪問它的信息:

如何在iOS 4.0+中從相機拍攝的照片中訪問照片EXIF?

信息詞典包含另一個名為“ UIImagePickerControllerMediaMetadata”的鍵。 只需NSLog的allKeys即可獲取日期密鑰。

NSDictionary *metadata = [info objectForKey: UIImagePickerControllerMediaMetadata];
NSLog(@"%@",metadata);

從元數據中選擇所需的內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM