ios - PSCollectionView's delegate not fire -
i followed pscollectionview's usage on github.
this code:
- (void)viewdidload { self.collectionview = [[pscollectionview alloc] init]; self.collectionview.collectionviewdatasource = self; self.collectionview.collectionviewdelegate = self; self.collectionview.numcolsportrait = 2; [self.view addsubview:self.collectionview]; [self.collectionview reloaddata]; // if don't call console empty. } - (nsinteger)numberofrowsincollectionview:(pscollectionview *)collectionview { nslog(@"num rows"); return 2; } - (pscollectionviewcell *)collectionview:(pscollectionview *)collectionview cellforrowatindex:(nsinteger)index { nslog(@"cell row"); return nil; } - (cgfloat)collectionview:(pscollectionview *)collectionview heightforrowatindex:(nsinteger)index { nslog(@"height row"); return 0.0; } my console empty. when called [collectionview reloaddata], here result:
num rows height row height row num rows i have no idea why "cell row" not printed out.
any hint or suggestion? thank you.
it's because have typo , it's not viewdidload() it's viewdidload(), viewdidload() never gets called. so, you're not able set delegate , datasource properly.
Comments
Post a Comment