Protocol

NSCollectionViewDelegateFlowLayout

The NSCollectionViewDelegateFlowLayout protocol defines methods for providing layout information to an NSCollectionViewFlowLayout object. Implement the methods of this protocol when you want to customize the layout behavior and perhaps return different values for different items or sections.

Overview

All of the methods in this protocol are optional, so you can implement only the methods you need to achieve the desired layout. If you do not implement a particular method, the flow layout object obtains default values from its own properties and applies them uniformly. Implement your methods in the object you assign to the delegate property of the collection view itself.

Symbols

Getting the Size of Items

Getting the Section Spacing

func collectionView(NSCollectionView, layout: NSCollectionViewLayout, insetForSectionAt: Int)

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

func collectionView(NSCollectionView, layout: NSCollectionViewLayout, minimumLineSpacingForSectionAt: Int)

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

func collectionView(NSCollectionView, layout: NSCollectionViewLayout, minimumInteritemSpacingForSectionAt: Int)

Asks the delegate for the spacing between successive items of a single row or column.

Getting the Header and Footer Sizes

func collectionView(NSCollectionView, layout: NSCollectionViewLayout, referenceSizeForHeaderInSection: Int)

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

func collectionView(NSCollectionView, layout: NSCollectionViewLayout, referenceSizeForFooterInSection: Int)

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

Relationships