I have a very simple collection view, but somehow it keeps crashing. here is the error message:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier Reuse - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
and my codes:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *reuseCellIdentifier = @"Reuse";
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseCellIdentifier forIndexPath:indexPath];
if (!cell) {
cell = [[UICollectionViewCell alloc]initWithFrame:CGRectMake(0, 0, 106, 95)];
}
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 45, 45)];
imageView.image = [UIImage imageNamed:@"image_name"];
[cell addSubview:imageView];
UILabel *name = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 106, 15)];
name.text = @"user";
return cell;
}
Help!!


