- (void)getImagesFromPhotoLibrary{
void (^assetsEnumeration)(ALAsset *,NSUInteger,BOOL *) = ^(ALAsset *asset,NSUInteger index,BOOL *stop){
if(asset!=nil)
{
NSLog(@"obtained Asset %@",[asset valueForProperty:ALAssetPropertyURLs]);
[self.dataContainer addObject:asset];
NSLog(@"assest...%@",asset);
[self setImage];
}
NSLog(@"data container...%@",self.dataContainer);
};
void (^assetsGroupEnumeration)(ALAssetsGroup *,BOOL *) = ^(ALAssetsGroup *group,BOOL *status){
if(group!=nil)
{
[group enumerateAssetsUsingBlock:assetsEnumeration];
}
};
// allocate the library
library = [[ALAssetsLibrary alloc]init];
[library enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:assetsGroupEnumeration failureBlock:^(NSError *error) {
NSLog(@"Error :%@", [error localizedDescription]);
}];
}
Set Image:-
[imageview.image setImage:[UIImage imageWithCGImage:[(ALAsset*)[dataContainer objectAtIndex:indexPath ]thumbnail]]];