---
title: "How to set collection view cell size in iOS?"  
description: "How to set collection view cell size in iOS?"  
author: "Anonymous User"  
published: 2015-12-29  
updated: 2015-12-29  
canonical: https://www.mindstick.com/forum/33803/how-to-set-collection-view-cell-size-in-ios  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# How to set collection view cell size in iOS?

I have created an Photo album using UICollectionView.\
I want to [handle](https://www.mindstick.com/articles/311004/suede-skillet-handle-cover) cell [size](https://www.mindstick.com/forum/159799/how-can-you-manage-the-size-of-mdf-and-ldf-files) by codding.\
If it is possible then please provide [me the code](https://www.mindstick.com/forum/156831/can-you-tell-me-the-code-to-write-a-c-sharp-program).\
Thank you.

## Replies

### Reply by Tarun Kumar

To set the collection view cell size, you can use collectionView method **sizeForItemAtIndexPath:** .\
Here is an example:

```
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)layout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {  CGFloat width = (CGRectGetWidth(self.view.frame)/3.0f)-15);  return CGSizeMake(width, (width *1.1f));  // total 4 views displayed at a time;}
```

I hope the above code is helpful for you, because I am using that code in our own sample.


---

Original Source: https://www.mindstick.com/forum/33803/how-to-set-collection-view-cell-size-in-ios

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
