The main idea of customizing multi-Select albums
- Import Assetslibrary Framework
- Gets the resource group "0" from the Repository, filters the "1" photo and displays the group in the list.
- Click on the resource group to enter the corresponding album, get all the photo resources in the group "2"
"0 " Get resource Group [_assetslibrary Enumerategroupswithtypes:alassetsgroupall usingblock:^ (alassetsgroup *group , BOOL *stop) {if (group ) {[_assetsa Rray addobject:group ]; [_tableview Reloaddata]; }} failureblock:^ (Nserror *error) {Uialertview *alert = [[Uialertview alloc]initwithtitle:@" Prompt " message:@" album Acquisition failed " delegate : Self cancelbuttontitle:@ "Cancel" Otherbuttontitles:nil]; [Alert show]; }];
【1setAssetsFilter:[ALAssetsFilter allPhotos]];
【2The Get Photo resource-(void) getimages{_thumbnailmeasure = (screen_width-( Self. Numberofimageeachrow+1) *photo_default_margin)/ Self. Numberofimageeachrow;CGRectframe = CGRectMake (0,0, _thumbnailmeasure, _thumbnailmeasure); [ Self. Assetsgroupenumerateassetsusingblock:^ (Alasset *result, Nsuinteger Index,BOOL*stop) {if(Result) {Assetview *assetview = [[Assetview alloc]initwithasset:result withframe:frame]; Assetview. Delegate= Self; [_assetsarray Addobject:assetview]; } }];}
Related actions
Get Resource Group name
[_assetsgroup Valueforproperty:alassetsgrouppropertyname];
Get poster thumbnails for a resource group
[UIImage Imagewithcgimage:_assetsgroup.posterimage];
Get a square thumbnail of a photo resource
[UIImage Imagewithcgimage:_asset.thumbnail];
Get an image of the full resolution of a photo resource (image assets are encapsulated first)
[[Asset defaultrepresentation] fullresolutionimage];
Get resource type
[Asset Valueforproperty:alassetpropertytype];
Demo code uploaded github
Https://github.com/Lotheve/LXXMutiAlbum
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
iOS Development-Customize multi-Select albums