---
title: "How to remove cell spacing in UICollectionView in iOS?"  
description: "How to remove cell spacing in UICollectionView in iOS?"  
author: "Anonymous User"  
published: 2015-12-29  
updated: 2015-12-29  
canonical: https://www.mindstick.com/forum/33804/how-to-remove-cell-spacing-in-uicollectionview-in-ios  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# How to remove cell spacing in UICollectionView in iOS?

I want to [remove](https://yourviews.mindstick.com/story/4554/8-harmful-weeds-to-remove-from-garden) cell spacing of UICollectionView in our application. I use many code for removing [space](https://www.mindstick.com/articles/12954/do-your-electrical-repair-in-your-own-space) but they are not working. Please provide [me the code](https://www.mindstick.com/forum/156831/can-you-tell-me-the-code-to-write-a-c-sharp-program) also.

Thanks.

## Replies

### Reply by Tarun Kumar

If you want to remove cell spacing in UICollectionView, then you need to set cell paddings. and collectionView provide some important methods to handle spacing are **insetForSectionAtIndex:** , **minimumLineSpacingForSectionAtIndex:** and **minimumInteritemSpacingForSectionAtIndex:** .\
*Here are the examples:*

```
- (UIEdgeInsets)collectionView:(UICollectionView*)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {    return UIEdgeInsetsMake(10, 10, 8, 8); // top, left, bottom, right}- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {    return 0.0;}
```


---

Original Source: https://www.mindstick.com/forum/33804/how-to-remove-cell-spacing-in-uicollectionview-in-ios

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
