2016-11-27 18 views
-2

當我點擊我的照片庫中的一張照片時,它將使用xip轉到另一個視圖控制器,並在xip中顯示此圖像。還有一個詳細按鈕。當按下詳細按鈕時,我想在該xip上顯示所選圖像的創建日期,位置大小,圖像路徑,相機信息和白平衡。如何在ios中獲取圖像日期,位置,大小,方向?

請幫我,我該如何做到這一點在目標c。

+3

請出示開展這項研究的證據,你已經實現了代碼和您所遇到的確切問題...請參閱[如何問](http://stackoverflow.com/help/how-to-ask)並考慮提供[最小,完整和可驗證的示例](http://stackoverflow.com/help/mcve) – David

+0

您是否使用故事板或xib? – user3182143

+0

是的,我會用xip顯示這些信息 –

回答

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]; 

} 
相關問題