ios - Nothing apear in UIcollectionView Controller -


i have uicollectionview in first view of application after uinavigationviewcontroller in storyboard :

enter image description here

this rootviewcontroller.h

#import <uikit/uikit.h> @interface rootviewcontroller : uicollectionviewcontroller<uicollectionviewdelegate,uicollectionviewdatasource> @property (nonatomic, strong) nsarray *entries;  @end 

and rootviewcontroller.m :

#import "rootviewcontroller.h" #import "apprecord.h" #import "cell.h" #define kcustomrowcount     7   @interface rootviewcontroller () <uicollectionviewdelegate,uicollectionviewdatasource,uicollectionviewdelegateflowlayout> // set of icondownloader objects each app @property (nonatomic, strong) nsmutabledictionary *imagedownloadsinprogress; @end   @implementation rootviewcontroller  #pragma mark   // ------------------------------------------------------------------------------- //  viewdidload // ------------------------------------------------------------------------------- - (void)viewdidload {  nslog(@"inside class");     [super viewdidload];    // self.title = @"my title";      //self.collectionview.delegate = self;     //self.collectionview.datasource=self;  }   - (nsinteger)collectionview:(uicollectionview *)collectionview numberofitemsinsection:(nsinteger)section{     nsuinteger count = [self.entries count];     nslog(@"count: %lu", (unsigned long)count);      if (count == 0)     {         return kcustomrowcount;     }     return count; }   - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath{      nslog(@"inside cell");     apprecord *apprecord = [self.entries objectatindex:indexpath.row];     cell *cell = [collectionview dequeuereusablecellwithreuseidentifier:@"my_cell" forindexpath:indexpath];     uiimage *truckimage = [[uiimage alloc] init];     truckimage = [uiimage imagenamed:@"default.png"];     cell.imageview.image = truckimage;     return cell; }  @end 

now problem none of "cellforitematindexpath" or "numberofitemsinsection" or "viewdidload" getting called , output on simulator black screen.

this reload section of appdelegate class :

    __block parseoperation *weakparser = parser;      parser.completionblock = ^(void) {         if (weakparser.apprecordlist) {             dispatch_async(dispatch_get_main_queue(), ^{                 rootviewcontroller *rootviewcontroller = (rootviewcontroller*)[(uinavigationcontroller*)self.window.rootviewcontroller topviewcontroller];                  rootviewcontroller.entries = weakparser.apprecordlist;                 if(weakparser.apprecordlist != nil)                     nslog(@"weakparser.apprecordlist not nill");                 [rootviewcontroller.collectionview reloaditemsatindexpaths:[rootviewcontroller.collectionview indexpathsforvisibleitems]];                 [rootviewcontroller.collectionview reloaddata];             });         }          self.queue = nil;     };      [self.queue addoperation:parser];     self.applistdata = nil; } 

did add delegate , datasource connection collection view? it's common mistake, usually. they're commented out in code, assume did via storyboard


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -