ios - UICollectionView datasource not being called -


even though setting delegate , datasource, data source methods never being called.

i have viewcontroller adds subview such:

evphotocollectionviewcontroller *pc = [[evphotocollectionviewcontroller alloc] initwithnibname:@"evphotocollectionviewcontroller" bundle:nil]; self.damagephotosview = pc.view; 

inside evphotocollectionviewcontroller have delegate , datasource wired in xib, via code follows:

- (void)viewdidload {     [super viewdidload];     // additional setup after loading view nib.     self.collectionview.delegate = self;     self.collectionview.datasource = self;      [self.collectionview reloaddata]; } 

none of datasource methods ever called. have verified self.collectionview not null when calls reloaddata.

thanks!

i think there several things wrong here--and there complexities view controller containment may need read on.

first off, you're not adding evphotocollectionviewcontroller view subview of vc, eg:

[self addsubview:pc.view]; 

also, you're not setting frame evphotocollectionviewcontroller, depending on how it's implemented, might not show right size/position.

lastly, doesn't you're retaining evphotocollectionviewcontroller anywhere. view retained view hierarchy, looks instance of evphotocollectionviewcontroller dealloc'd once function creating goes out of scope.

view controller containment: how view controller containment work in ios 5?


Comments