2011-12-12 115 views

回答

10
[[asset defaultRepresentation] metadata]; 

返回给定资产表示的元数据字典。查看这本字典中的数据,我不确定,但我认为该字典(和子字典)中的密钥与CGImageProperties Reference中列出的密钥相同。

+0

谢谢,我负荷的NSDictionary元数据,但不知道如何解析键。 –

+0

解决,谢谢。 –

0

这是一个完整的答案......所有在一个地方

NSDictionary *nsd = [[asset3 defaultRepresentation] metadata]; 
    NSString *widthStr = [nsd objectForKey: @"PixelWidth"]; 
    NSString *heightStr = [nsd objectForKey: @"PixelHeight"]; 

    NSLog(@"nsd: %@ ... widthStr: %@ ... heightStr: %@ ...", nsd, widthStr, heightStr); 

输出:

nsd: { 
    ColorModel = RGB; 
    DPIHeight = 72; 
    DPIWidth = 72; 
    Depth = 8; 
    Orientation = 1; 
    PixelHeight = 1136; 
    PixelWidth = 642; 
    "{Exif}" =  { 
     ColorSpace = 1; 
     ComponentsConfiguration =   (
      1, 
      2, 
      3, 
      0 
     ); 
     ExifVersion =   (
      2, 
      2, 
      1 
     ); 
     FlashPixVersion =   (
      1, 
      0 
     ); 
     PixelXDimension = 642; 
     PixelYDimension = 1136; 
     SceneCaptureType = 0; 
    }; 
    "{TIFF}" =  { 
     Orientation = 1; 
     ResolutionUnit = 2; 
     XResolution = 72; 
     YResolution = 72; 
    }; 
} ... widthStr: 642 ... heightStr: 1136 ...