从 ALAsset 中取出属性

 

#pragma mark -  从相册数组中取出所有的 图片数据
-(NSMutableArray *)getImageFromAlbumArray:(NSArray *)albumArr
{
    NSMutableArray *imageArray = [[NSMutableArray alloc]init];
    if (albumArr && [albumArr count]!=0) {
        
        for (int i=0;i<[albumArr count];i++) {
            ALAsset *  assetPhotos = [albumArr objectAtIndex:i];
            //类型, Location , 时长,方向,日期,格式 , URL地址
            NSString * nsALAssetPropertyType = [ assetPhotos valueForProperty:ALAssetPropertyType ] ;
            NSString * nsALAssetPropertyLocation = [ assetPhotos valueForProperty:ALAssetPropertyLocation ] ;//拍照地址
            NSString * nsALAssetPropertyDuration = [ assetPhotos valueForProperty:ALAssetPropertyDuration ] ;
            NSString * nsALAssetPropertyOrientation = [ assetPhotos valueForProperty:ALAssetPropertyOrientation ] ;
            NSString * nsALAssetPropertyDate = [ assetPhotos valueForProperty:ALAssetPropertyDate ] ;
            NSString * nsALAssetPropertyRepresentations = [ assetPhotos valueForProperty:ALAssetPropertyRepresentations ] ;
            NSString * nsALAssetPropertyURLs = [ assetPhotos valueForProperty:ALAssetPropertyURLs ] ;
            NSString * nsALAssetPropertyAssetURL = [ assetPhotos valueForProperty:ALAssetPropertyAssetURL ] ;
            
            NSLog(@"**************** ALAsset Date : %@  , URLs : %@ ",nsALAssetPropertyDate,nsALAssetPropertyURLs );
            
            
            //type:ASSET_PHOTO_ASPECT_THUMBNAIL 取大图会造成内存溢出
            UIImage *tempImg  = [ASSETHELPER  getImageFromAsset:assetPhotos  type:ASSET_PHOTO_ASPECT_THUMBNAIL];
            [imageArray addObject:tempImg];
        }
        
    }
    
    
    return imageArray;
}

 

posted on 2014-12-29 10:05  奋进的闹钟  阅读(320)  评论(0编辑  收藏  举报

导航