Pregunta

I have my own collectionView in my app. I don't want to use the default UIImagePicker for my app & I want to implement Image Picker with my collection View.

Can anyone tell me how to implement custom selecting Album View and after select the Album, How to implement custom View to view all the images in that album.

Sorry if this is very easy question.

¿Fue útil?

Solución

This can be done with help of ALASSETS. You can find documentation on it below. https://developer.apple.com/library/ios/documentation/AssetsLibrary/Reference/ALAsset_Class

ALAssetsLibrary *al = [[ALAssetsLibrary alloc] init];
assets = [[NSMutableArray alloc] init];
[al enumerateGroupsWithTypes:ALAssetsGroupAll

                  usingBlock:^(ALAssetsGroup *group, BOOL *stop)
 {
     [group enumerateAssetsUsingBlock:^(ALAsset *asset, NSUInteger index, BOOL *stop)
      {
          if (asset)
          {  
               NSLog(@"%@",asset);  

              NSLog(@".. do something with the asset");    
          }
      }
      ];
 }

                         failureBlock:^(NSError *error)
      {
          // User did not allow access to library
         // .. handle error 
      }
      ] ;

If you want to populate it to collection view you need to create a custom cell having Alasset type variable.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top