ios - Custom uicollectionview - pass data -


i have uicollectionview use custom cell:

[_collectionview registernib:[uinib nibwithnibname:@"collectionviewcell" bundle:nil] forcellwithreuseidentifier:@"cellidentifier"];  - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath {      collectionviewcell *cell = (collectionviewcell *)[collectionview dequeuereusablecellwithreuseidentifier:@"cellidentifier" forindexpath:indexpath];      cell.articolo = [_array objectatindex:indexpath.row]; 

i want pass object articolo cell, create property:

@property (strong, nonatomic) nsmutabledictionary *articolo; 

but if try read property in 1 of method:

@implementation collectionviewcell - (id)initwithframe:(cgrect)frame {     self = [super initwithframe:frame];     if (self) {nslog(@"articolo: %@",_articolo);}     return self; }  - (id)initwithcoder:(nscoder*)adecoder {     self = [super initwithcoder:adecoder];     if(self) {nslog(@"articolo: %@",_articolo);}     return self; } - (void) awakefromnib {     [super awakefromnib];     nslog(@"articolo: %@",_articolo); } 

i null value, error? how can pass object cell?

your code perfect, null value in of above method because called when cell initialized.

you can value putting setter method this.

-(void)setarticolo:(nsmutabledictionary *)articolo {    _articolo = articolo;  } 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -