How to Display asset url In collection view ios

ALAssetsGroupEnumerationResultsBlock assetsEnumerationBlock = ^(ALAsset *result, NSUInteger index, BOOL *stop) 
                 {
                if (result) {
             [assets addObject:result];
             ALAssetRepresentation *rep = [result defaultRepresentation];
            photoname=[rep filename];
            imageurl=[rep url];
            NSLog(@"result %@",result);
            NSLog(@"name %@",photoname);//Img0001.Jpg
            NSLog(@"name %@",imageurl);//assets-library://asset/asset.JPG?id=3B36DBC8-A2F7-4088-ADEF-A9E2FF8FD927&ext=JPG

            [print addObject:photoname];

            //NsuserDefaults
            //        NSMutableArray *mutableArray = [[NSMutableArray alloc] initWithArray:print];
            //        [[NSUserDefaults standardUserDefaults] setObject:mutableArray forKey:@"test"];
            retArray = [[NSMutableArray alloc] initWithArray:((NSMutableArray *) [[NSUserDefaults standardUserDefaults] objectForKey:@"test"])];
            NSLog(@"res %@",retArray);
           }
        };
    ALAssetsFilter *onlyPhotosFilter = [ALAssetsFilter allPhotos];
    [self.assetsGroup setAssetsFilter:onlyPhotosFilter];
    [self.assetsGroup enumerateAssetsUsingBlock:assetsEnumerationBlock];

}

Answers


You need to use the assets library to get the asset for the URL, and then get the image from the asset. Currently you are treating the asset URL as an asset rather than using the URL to get the asset:

[self.assetsLibrary assetForURL:assetURL resultBlock:^(ALAsset * asset) {
    UIImage *image = [UIImage imageWithCGImage:[asset thumbnail]];

    // use the image for something 
}

NSURL *assetURL = notequal[indexPath.row];

[self.assetslibrary assetForURL:assetURL resultBlock:^(ALAsset * asset) {
    UIImage *image = [UIImageimageWithCGImage[asset thumbnail]];
    UIImageView *imageView = (UIImageView *)[cell viewWithTag:kImageViewTag];

    imageView.image = thumbnail;
}];

return cell;

Need Your Help

Calling C code from a bootloader

c gcc assembly x86 bootloader

I'm trying to write a bootloader. I would like to compile some C code so the bootloader can load it into memory and jump there.

excel: most used numbers from massive

excel

How to get a formula, which will show 6 most used numbers from C2:H17 with persantage?