I have subclassed a UICollectionViewCell-
@interface ListCell : UICollectionViewCell
@property(nonatomic,strong) IBOutlet UILabel *lblAppName;
@end
I have made an xib for the same ,made all the IBOutlet collection as well as set the class of the XIB , while using this Cell in the Collection view delegate method i get a nill value while trying to access the label instance.
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {
ListCell *cell = (ListCell *)[cv dequeueReusableCellWithReuseIdentifier:@"ListCell" forIndexPath:indexPath];
AppDetails *temp=[arrApplist objectAtIndex:indexPath.item];
cell.lblAppName.text=temp.strName;
return cell;
}
i have registered the cell to my collection view by:
[collectionView registerClass:[ListCell class] forCellWithReuseIdentifier:@"ListCell"];
is there something else i might be missing??
Thanks in advance.
Instead of registering the class, I think you need to register the xib, using registerNib:forCellWithReuseIdentifier:. Try that, and see if that helps.