What I'm trying to achieve is a 3x3 table with UICollectionView. But it just doesn't display any cells when running the application. It does display the background color of the CollectionView though (which I set to blue) Can someone help me here?
What I have done is create a storyboard and simply dragged a CollectionViewController onto it. This controller also brought a nested CollectionView with it. Then I simply used the settings to make its background blue and to add a cell to it of which I made the background purple (both only for testing). Finally dragged a UILabel onto it. Now when run it just displays the blue background but no cells even though they are clearly visible in the editor. I've then tried to create a custom UICollectionViewController, assign the class to the CollectionViewController instead of the standard class and did the same to the cell (assign a custom UICollectionViewCell). In the custom UICollectionViewController I implemented the following methods:
-(NSIntegear)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 1;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return 9;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"Cell";
AboutYourGoalsMultiSelectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
[[cell goal]setText:@"T"];
return cell;
}
I set the identifier of the cell to "Cell" and made an outlet connection of dataSource and delegate between the CollectionView and the custom UICollectionViewController. Everything compiles fine. So what am I missing? Shouldn't it have displayed something way before doing all these tweaks by simply using the editor?


collectionView:cellForItemAtIndexPath:to a) make sure it's getting called and, b) see what else might be going wrong. - mharper