Question: This is my ViewController.m file's code for Collection view:

```
- (void)viewDidLoad
{
     img = [[NSArray alloc] initWithObjects:@"1.png",@"2.png",@"3.png", nil];
     name = [[NSArray alloc] initWithObjects:@"Flag",@"Blue",@"Fish", nil];
     [self.collectionview registerNib:[UINib nibWithNibName:@"cell" bundle:nil] forCellWithReuseIdentifier:@"CELL"];
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return [img count];
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell1 = [collectionview dequeueReusableCellWithReuseIdentifier:@"CELL" forIndexPath:indexPath];
    UIImageView *reciveimageview = (UIImageView *)[cell1 viewWithTag:100];
    reciveimageview.image = [UIImage imageNamed:[img objectAtIndex:indexPath.row]];
    cell1.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:[img objectAtIndex:indexPath.row]]];
    cell1.cellLabel.text = [name objectAtIndex:indexPath.row];
    return cell1;
}

@end

```

Now it is giving me the error of `Undeclared identifier of Cell and Cell1` 
Don't know why.

Answer: 
Add like this
 static NSString \*identifier = @"Cell";

```
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];

UIImageView *recipeImageView=(UIImageView *)[cell viewWithTag:100];
recipeImageView.image = [UIImage imageNamed:[jsonImagesArr objectAtIndex:indexPath.row]];
[cell addSubview:recipeImageView];

```
Have you set the identifier in xib as "CELL"

[![enter image description here](https://i.stack.imgur.com/81Qz1.png)](https://i.stack.imgur.com/81Qz1.png)

You need to register your nib/class if you are using a custom cell.
You can do that by

```
[self.myCollectionView registerNib:[UINib nibWithNibName:@"ShubhCalendarCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"ShubhCalendarCollectionViewCell"]; 

```

Make sure your Nib name and identifier are not mis- spelled.
Hope it helps.

Happyy coding.. !!