ios - storing all images from camera roll as an array -


i new ios , objective-c, trying create app contains component takes of images camera roll , creates slideshow them. believe first step create array of images stored in camera roll. can create animation array. currently, have button, designated "play", when selected should display slideshow uiimageview. however, code not work right now. or suggestions appreciated. here code far:

- (ibaction)play:(id)sender { nsmutablearray *allphotos= [[nsmutablearray alloc]init]; alassetslibrary *library = [[alassetslibrary alloc] init];  [library enumerategroupswithtypes:alassetsgroupsavedphotos usingblock:^(alassetsgroup *group, bool *stop) {      [group setassetsfilter:[alassetsfilter allphotos]];     [group enumerateassetsusingblock:^(alasset *result, nsuinteger index, bool *stop) {         if (result == nil) {             return;         }          alassetrepresentation *representation = [result defaultrepresentation];         uiimage *image = [uiimage imagewithcgimage:[representation fullscreenimage]];         [allphotos addobject:image];     }];  } failureblock: ^(nserror *error) {      nslog(@"no groups"); }];  uiimageview *animationimageview = [[uiimageview alloc] initwithframe:cgrectmake(60, 95, 86, 193)]; animationimageview.animationimages = allphotos; animationimageview.animationduration = 0.5;  [self.view addsubview:animationimageview]; [animationimageview startanimating]; 

}

see answer here posted:

since alassetslibrary deprecated , photo framework new one. made own function in objective c photos camera roll , store in nsarray , displayed in collectionview

 nsarray *imagearray;  nsmutablearray *mutablearray;      -(void)getallphotosfromcamera     {         imagearray=[[nsarray alloc] init];         mutablearray =[[nsmutablearray alloc]init];          phimagerequestoptions *requestoptions = [[phimagerequestoptions alloc] init];         requestoptions.resizemode   = phimagerequestoptionsresizemodeexact;         requestoptions.deliverymode = phimagerequestoptionsdeliverymodehighqualityformat;         requestoptions.synchronous = true;         phfetchresult *result = [phasset fetchassetswithmediatype:phassetmediatypeimage options:nil];          nslog(@"%d",(int)result.count);          phimagemanager *manager = [phimagemanager defaultmanager];         nsmutablearray *images = [nsmutablearray arraywithcapacity:[result count]];          // assets contains phasset objects.          __block uiimage *ima;         (phasset *asset in result) {             // asset              [manager requestimageforasset:asset                                targetsize:phimagemanagermaximumsize                               contentmode:phimagecontentmodedefault                                   options:requestoptions                             resulthandler:^void(uiimage *image, nsdictionary *info) {                                 ima = image;                                  [images addobject:ima];                             }];           }          imagearray = [images copy];  // can direct use nsmutuable array images     } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -