Why aren't my subclassed cells displaying?
I've tried calling awake From Nib and initWithCoder and initWithFrame but none of the attributes are displaying
@interface PhotoCollectionViewCell : UICollectionViewCell
@property (strong, nonatomic) IBOutlet UIImageView *photoImageView;
@end
And in my .m file
@implementation PhotoCollectionViewCell
-(void)awakeFromNib {
self.photoImageView.frame = self.bounds;
self.backgroundColor = [UIColor lightGrayColor];
}
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
self.photoImageView.frame = self.bounds;
self.backgroundColor = [UIColor lightGrayColor];
}
return self;
}
My cell's class in interfacebuilder is set to PhotoCollectionViewCell and the reuse identifer is properly set in interfacebuilder
@interface HomeViewController () {
NSMutableArray *photosArray;
}
@end
And homeview.m file
-(void)viewDidLoad {
[self.collectionView registerClass:[PhotoCollectionViewCell class] forCellWithReuseIdentifier:@"photoCell"];
photosArray = [[NSMutableArray alloc] init];
UIImage *placeholder = [UIImage imageNamed:@"placeholder.png"];
[photosArray addObject:placeholder];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return photosArray.count;
}
- (PhotoCollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
PhotoCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"photoCell" forIndexPath:indexPath];
cell.photoImageView.image = [photosArray objectAtIndex:indexPath.row];
return cell;
}



registerClass...