This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; | |
[library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *libraryStop) { | |
NSInteger assetCount = [group numberOfAssets]; | |
NSIndexSet *indexes = [NSIndexSet indexSetWithIndex:assetCount-1]; | |
[group enumerateAssetsAtIndexes:indexes options:NSEnumerationReverse usingBlock:^(ALAsset *result, NSUInteger index, BOOL *groupStop) { | |
if(result){ | |
CGImageRef imageRef = [[result defaultRepresentation] fullResolutionImage]; | |
UIImage *image = [UIImage imageWithCGImage:imageRef]]; | |
// Do stuff with the image. |