---
title: "Inserting Image in UICollectionView in iOS"  
description: "Inserting Image in UICollectionView in iOS"  
author: "Anonymous User"  
published: 2015-11-30  
updated: 2015-11-30  
canonical: https://www.mindstick.com/forum/33661/inserting-image-in-uicollectionview-in-ios  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# Inserting Image in UICollectionView in iOS

I am new in [application development](https://www.mindstick.com/articles/65303/8-benefits-of-android-application-development-for-online-business) on iPhone/iPad, so I [am getting](https://www.mindstick.com/forum/34179/i-am-getting-error-while-assigning-the-data-to-the-array-list) [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) to [insert](https://www.mindstick.com/blog/173/executing-insert-delete-or-update-query-in-sqlserver-using-ado-dot-net) [image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) in [collection view](https://www.mindstick.com/forum/33803/how-to-set-collection-view-cell-size-in-ios).\
I check over on [internet](https://www.mindstick.com/articles/44650/what-should-you-do-during-an-internet-outage) but not getting correct solution.\
Any help would be greatly appreciated.\
Thanks in advance.

## Replies

### Reply by Tarun Kumar

For displaying Image use **cellForItemAtIndexPath:** method of UICollectionView.\
for example:

```
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{    static NSString *identifier = @"Cell";    UICollectionViewCell *cell = [collectionView                          dequeueReusableCellWithReuseIdentifier:identifier                                                forIndexPath:indexPath];    UIImageView *recipeImageView = (UIImageView *)[cell viewWithTag:100];    recipeImageView.image = [UIImage imageNamed:[recipeImages                          objectAtIndex:indexPath.row]];    cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage                                     imageNamed:@"imgName.jpg"]];    [self.view addSubview:recipeImageView];    cell.backgroundColor=[UIColor colorWithPatternImage:[UIImage                          imageNamed:[recipeImages                          objectAtIndex:indexPath.row]]];    return cell;}
```


---

Original Source: https://www.mindstick.com/forum/33661/inserting-image-in-uicollectionview-in-ios

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
