objective c - Sow Multiple Images Selected From ELCImagePicker In a Collection view in IOS -
i have view controller in had added collection view, when pass array of static images shows fine have pass images through gallery selection or camera have used elcimagepicker in project select multiple images, when select multiple images gallery using elcimagepicker select images , when hit done button on top right of firstly not go view controller show images , no images seen in collection view. code is,
- (ibaction)select:(id)sender { elcimagepickercontroller *elcpicker = [[elcimagepickercontroller alloc] initimagepicker]; elcpicker.maximumimagescount = 4; //set maximum number of images select, defaults 4 elcpicker.returnsoriginalimage = no; //only return fullscreenimage, not fullresolutionimage elcpicker.returnsimage = yes; //return uiimage if yes. if no, return asset location information elcpicker.onorder = yes; //for multiple image selection, display , return selected order of images elcpicker.imagepickerdelegate = self; //present modally [self presentviewcontroller:elcpicker animated:yes completion:nil]; } - (void)elcimagepickercontroller:(elcimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsarray *)info{ if([info count] > 0) { (nsdictionary *imageinfo in info) { uiimage *image = [imageinfo valueforkey:uiimagepickercontrolleroriginalimage]; nslog(@"iii %@",image); _arrimages=image; nslog(@"ppp %@",_arrimages); //do here } } [imagepicker dismissviewcontrolleranimated:yes completion:nil]; } - (void)elcimagepickercontrollerdidcancel:(elcimagepickercontroller *)picker{ [self dismissviewcontrolleranimated:yes completion:null]; } -(nsinteger)numberofsectionsincollectionview:(uicollectionview *)collectionview{ return 1; } -(nsinteger) collectionview:(uicollectionview *)collectionview numberofitemsinsection:(nsinteger)section{ return [_arrimages count]; } - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath{ patterncell *cell= [collectionview dequeuereusablecellwithreuseidentifier:@"cell" forindexpath:indexpath]; nsstring *string=[_arrimages objectatindex:indexpath.row]; nslog(@"image %@",string); cell.img.image=[uiimage imagenamed:string]; cell.name.text=string; return cell; } -(cgsize)collectionview:(uicollectionview *)collectionview layout: (uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath{ return cgsizemake(150.0, 150.0);} -(uiedgeinsets)collectionview:(uicollectionview *)collectionview layout: (uicollectionviewlayout *)collectionviewlayout insetforsectionatindex: (nsinteger)section{ return uiedgeinsetsmake(5, 5, 5, 5); }
can 1 me i'm making mistake? shows screen, enter image description here
you need pass selected images collectionview.
- (void)elcimagepickercontroller:(elcimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsarray *)info{ if([info count] > 0) { (nsdictionary *imageinfo in info) { uiimage *image = [imageinfo valueforkey:uiimagepickercontrolleroriginalimage]; nslog(@"iii %@",image); _arrimages=image; nslog(@"ppp %@",_arrimages); //reload collection view display selected images in cell. [_collectionview reloaddata]; } } [imagepicker dismissviewcontrolleranimated:yes completion:nil]; }
Comments
Post a Comment