Reputation: 21726
I have the task to implement something similar to UIImagePickerController for displaying and selecting images. The problem is to get the list of images on the device. I can't find any solution to get the images. So is there the way to get images?
Upvotes: 2
Views: 10591
Reputation: 8664
On that post there is a refence there.
It is looking interesting.
If not what you seek, you can create your own UIImagePicker, and you will need to go through the Assets Library framework to get access to the photos of the iPhone
The Assets Library framework provides access to the photos and videos in the user’s photo library.
Upvotes: 2
Reputation: 29767
See ALAssetsLibrary class.
An instance of ALAssetsLibrary provides access to the videos and photos that are under the control of the Photos application.
Code might be something like this
void (^assetEnumerator)(struct ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) {
if(result != NULL) {
NSLog(@"See Asset: %@", result);
}
};
void (^assetGroupEnumerator)(struct ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop) {
if(group != nil) {
[group enumerateAssetsUsingBlock:assetEnumerator];
}
};
library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupAlbum
usingBlock:assetGroupEnumerator
failureBlock: ^(NSError *error) {
NSLog(@"Failure");
}];
Upvotes: 3