<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionViewDelegateFlowLayout",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UICollectionViewDelegateFlowLayout"
  },
  "title" : "UICollectionViewDelegateFlowLayout"
}
-->

# UICollectionViewDelegateFlowLayout

The methods that let you coordinate with a flow layout object to implement a grid-based layout.

```
@MainActor protocol UICollectionViewDelegateFlowLayout : UICollectionViewDelegate
```

## Overview

The methods of this protocol define the size of items and the spacing between items in the grid. All of the methods in this protocol are optional. If you don’t implement a particular method, the flow layout delegate uses values in its own properties for the appropriate spacing information.

The [`UICollectionViewFlowLayout`](/documentation/UIKit/UICollectionViewFlowLayout) object expects the collection view’s delegate object to adopt this protocol. Therefore, implement this protocol on the object assigned to your collection view’s [`delegate`](/documentation/UIKit/UICollectionView/delegate) property.

## Topics

### Getting the size of items

[`collectionView(_:layout:sizeForItemAt:)`](/documentation/UIKit/UICollectionViewDelegateFlowLayout/collectionView(_:layout:sizeForItemAt:))

Asks the delegate for the size of the specified item’s cell.

### Getting the section spacing

[`collectionView(_:layout:insetForSectionAt:)`](/documentation/UIKit/UICollectionViewDelegateFlowLayout/collectionView(_:layout:insetForSectionAt:))

Asks the delegate for the margins to apply to content in the specified section.

[`collectionView(_:layout:minimumLineSpacingForSectionAt:)`](/documentation/UIKit/UICollectionViewDelegateFlowLayout/collectionView(_:layout:minimumLineSpacingForSectionAt:))

Asks the delegate for the spacing between successive rows or columns of a section.

[`collectionView(_:layout:minimumInteritemSpacingForSectionAt:)`](/documentation/UIKit/UICollectionViewDelegateFlowLayout/collectionView(_:layout:minimumInteritemSpacingForSectionAt:))

Asks the delegate for the spacing between successive items in the rows or columns of a section.

### Getting the header and footer sizes

[`collectionView(_:layout:referenceSizeForHeaderInSection:)`](/documentation/UIKit/UICollectionViewDelegateFlowLayout/collectionView(_:layout:referenceSizeForHeaderInSection:))

Asks the delegate for the size of the header view in the specified section.

[`collectionView(_:layout:referenceSizeForFooterInSection:)`](/documentation/UIKit/UICollectionViewDelegateFlowLayout/collectionView(_:layout:referenceSizeForFooterInSection:))

Asks the delegate for the size of the footer view in the specified section.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)