Loading tip into UICollectionViewCell
I am just starting to use UICollectionView, so bear with me!
How to load a cap into a cell?
It seems I need to register the nib and the class to be used, but that doesn't work.
code:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
[collectionView registerClass:[CluelessSymbolCell class] forCellWithReuseIdentifier:@"Symbol cell"];
[collectionView registerNib:[UINib nibWithNibName:@"CluelessSymbolCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"Symbol cell"];
CluelessSymbolCell *cell = (CluelessSymbolCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"Symbol cell" forIndexPath:indexPath];
CluelessClue *clue = [clueManager clueForIndexPath:indexPath];
[cell.backgroundImageView setImage:[UIImage imageNamed:[clue.imageNames objectAtIndex:0]]];
return cell;
}
+3
source to share