ios - Why I cannot assign image to custom collect CollectionViewCell -


i designed custom uicollectionviewcell , added image view outlet. then, connected image view cell. somehow, cannot assign image (uiimage) image view. below code cellforitematindexpath.

- (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath {     // service gallary custom collection view cell.     [self.collectionview registerclass:[servicegallarycell class] forcellwithreuseidentifier:collectioncellidentifier];      servicegallarycell *servicecollectioncell = (servicegallarycell*)[collectionview  dequeuereusablecellwithreuseidentifier:collectioncellidentifier forindexpath:indexpath];      if (collectionview == self.collectionview)     {         servicecollectioncell.image.image = [uiimage imagenamed:_imagesarray[indexpath.row]];     }      return servicecollectioncell;  } 

you can try:

-(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath {     static nsstring *collectionviewidentifier = @"cellidentifier";    servicegallarycell *cell = [collectionview dequeuereusablecellwithreuseidentifier:collectionviewidentifier forindexpath:indexpath];     cell.imageview.image = _imagesarray[indexpath.row];     return servicecollectioncell;  } 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -