ios - How to add CollectionView to ViewController with storyboard? -


i have moved collectionview viewcontroller, created iboutlet, established connection datasource , delegate, added protocols: uicollectionviewdatasource, uicollectionviewdelegate, uicollectionviewdelegateflowlayout, , added methods:

- (nsinteger)collectionview:(uicollectionview *)collectionview numberofitemsinsection:   (nsinteger)section { return 5; }   - (nsinteger)numberofsectionsincollectionview:(uicollectionview *)collectionview { return 1; }   - (adimagecell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath  { adimagecell *cell = (adimagecell *)[collectionview dequeuereusablecellwithreuseidentifier:@"adimagecellidentifier" forindexpath:indexpath]; cell.imageview1.image = [uiimage imagenamed:@"3.jpg"];  return cell; } 

i created custom cell , add viewdidload:

   [self.collectionview registernib:[uinib nibwithnibname:@"adimagecell" bundle:[nsbundle mainbundle]] forcellwithreuseidentifier:@"adimagecellidentifier"]; 

but problem here numberofitemsinsection , numberofsectionsincollectionview called, not cellforitematindexpath. why?

sometimes work if remove collectionview registerclass:forcellwithreuseidentifier viewdidload method.

collectionview:cellforitematindexpath: never gets called

hope you..


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -