As the title suggests I have a UICollectionView
that is hooked up to a UIViewController
through IB. I have a UICollectionView
subclass called imageCell
. In the viewcontroller viewDidLoad
method, I register the class like this:
CGRect collectionViewRect = CGRectMake(384, 60, 728, 924);
UICollectionViewFlowLayout *flow = [[UICollectionViewFlowLayout alloc] init];
imageCollectionView = [[UICollectionView alloc] initWithFrame:collectionViewRect collectionViewLayout:flow];
[imageCollectionView registerClass:[imageCell class] forCellWithReuseIdentifier:@"Cell"];
imageCollectionView.delegate = self;
imageCollectionView.dataSource = self;
I then call a method called getPhotos
in viewDidAppear
(for UI reasons) that gets photos from a service and then I call [imagCcollectionView reloadData];
inside getPhotos
.
Then in cellForItemAtIndexPath
I do the following:
imageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
GRKAlbum *album = [albums objectAtIndex:indexPath.item];
cell.titleLabel.text = album.name;
return cell;
I know I am not doing anything wrong here because the method is being called and cell
is not nil
and neither is album
.
So, when I run all of this code, the UICollectionView
appears, but nothing is in it. All I can see is the background color of the collectionView
. Any help at all would be greatly appreciated.
Note: I did NOT create an XIB for the imageCell
class when I made it and I am using Storyboards.