Just started to learn iOS development, today used to Uicollectionview, encountered some problems.
Customizing a Portalviewcell, of course, inherits from Uicollectionviewcell, and then associates it with the cell in the story version.
A public method is provided in the Portalviewcell:
-(void) Setupcellview;
Then write in the Cellforitematindexpath:
1 -(Uicollectionviewcell *) CollectionView: (Uicollectionview *) CollectionView Cellforitematindexpath: ( Nsindexpath *) Indexpath {2 Portalviewcell *cell = [CollectionView Dequeuereusablecellwithreuseidentifier:reuseidentifier Forindexpath:indexpath]; 3 [Cell Setupcellview]; 4 5 return cell; 6 }
Compile complete, correct, run up duang~ hang off, error message
Terminating app due to uncaught exception ' nsinvalidargumentexception ', Reason: '-[uicollectionviewcell Setupcellview]: Unrecognized selector sent to instance 0x7fd7535df8c0 '
Looking for a long time, no justice Ah, Portalviewacell have this method AH!!!!! And looked at the discovery of viewdidload there is such a sentence:
class] forcellwithreuseidentifier:reuseidentifier];
What the hell is this? Register the cell class? Delete and re-run will be OK.
Uicollectionviewcell the problems encountered by the