objective c - Fetch batch of iOS pictures -


i fetch fixed batches of pictures located on ios device. using new photos framework, , found workaround:

phfetchoptions *allphotosoptions = [phfetchoptions new];  allphotosoptions.sortdescriptors = @[[nssortdescriptor sortdescriptorwithkey:@"creationdate" ascending:no]];  // fetches photos -> fetch of them phfetchresult *allphotosresult = [phasset fetchassetswithmediatype:phassetmediatypeimage options:allphotosoptions];  nsindexset *indexset = [nsindexset indexsetwithindexesinrange:nsmakerange(currentindex, batch_size)];  // iterates on subset of fetched photos [allphotosresult enumerateobjectsatindexes:indexset options:0 usingblock:^(phasset *asset, nsuinteger idx, bool *stop) {     // stuff     } 

it works fine, first fetch photos fetchassetswithmediatype , select subset of result app load, seems quite heavy...

i wanted know if there way directly fetch photos batch batch, , not fetch them iterate. furthermore, perfect if keep indexes of last fetched batch, know i'll fetch next batch.

thanks help!

after more detailed search, found here looking : 1 use setfetchbatchsize nssortdescriptor.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -