Get Camera Roll photos to a Custom Collection View

I have an Custom Collection View with Cells. Here is my CollectionView code.

- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath;
{
    Cell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"MY_CELL" forIndexPath:indexPath];

    return cell;
}

I want to get images from Camera Roll & display in these cells. How can I get Camera Roll images to view in this Cell? Should I use an array to store names of the images & then show them in the Cell?
Can anyone please give me a solution with a code.

  • Using cameraOverlayView with UIImagePickerController
  • how to capture camera with UIImagePickerController in swift?
  • UIImagePickerController (using camera as source) does autorotate on iPad2, how do i stop it?
  • UIImagePickerController with camera source with allows editing yes : video trimming doesn't work
  • iOS Monotouch UIImagePickerController multiple photos / videos from camera
  • How to change button color on UIImagePickerController navigation bar?
  • Solutions Collect From Internet About “Get Camera Roll photos to a Custom Collection View”

    You can get the Albums and Photo/video assets using <AssetsLibrary/AssetsLibrary.h> framework :

    -(void)getAlbum
    {
       library = [[ALAssetsLibrary alloc] init];
    ALAssetsLibraryGroupsEnumerationResultsBlock listGroupBlock = ^(ALAssetsGroup *group, BOOL *stop) {
    
            if (group)
           {
                [_albumsArray addObject:group];
            } else {
                [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
            }
        };
    
       [library enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:listGroupBlock failureBlock:failureBlock]
    }
    

    While selecting album you will get photos/video by below method

    -(void)getAssets
    {
        ALAssetsGroupEnumerationResultsBlock assetsEnumerationBlock = ^(ALAsset * result, NSUInteger index, BOOL *stop) {
    
            if (result)
            {
    
            }
            else
            {
                [self.tableView reloadData];
            }
        };
    
        [_assetGroup setAssetsFilter:[ALAssetsFilter allAssets]];
    
        [_assetGroup enumerateAssetsUsingBlock:assetsEnumerationBlock];
    }
    

    Please refer this link for more info and example with table view. Alos you can replace table view with your UICollectionView

    Thanks!