CollectionViewDelegateColumnLayout
@objc
public protocol CollectionViewDelegateColumnLayout : CollectionViewDelegate
The delegate for CollectionViewColumnLayout to dynamically customize the layout
-
Asks the delegate for the number fo columns in a section
Declaration
Swift
@objc optional func collectionView(_ collectionView: CollectionView, layout collectionViewLayout: CollectionViewLayout, numberOfColumnsInSection section: Int) -> Int
Parameters
collectionView
The collection view
collectionViewLayout
The layout
section
A section index
Return Value
The desired number of columns in the section
-
Asks the delegate for insets to be applied to content of a given section
Declaration
Swift
@objc optional func collectionView(_ collectionView: CollectionView, layout collectionViewLayout: CollectionViewLayout, insetForSectionAt section: NSInteger) -> NSEdgeInsets
Parameters
collectionView
The collection view
collectionViewLayout
The layout
section
A section index
Return Value
Insets for the section
-
Asks the delegate for the item spacing to be applied to items of the same column of a section
Declaration
Swift
@objc optional func collectionView(_ collectionView: CollectionView, layout collectionViewLayout: CollectionViewLayout, interitemSpacingForSectionAt section: Int) -> CGFloat
Parameters
collectionView
The collection view
collectionViewLayout
The layout
section
A section index
Return Value
The desired spacing between items in the same column
-
Asks the delegate for the column spacing to applied to items in a given section
Declaration
Swift
@objc optional func collectionview(_ collectionView: CollectionView, layout collectionViewLayout: CollectionViewLayout, columnSpacingForSectionAt section: Int) -> CGFloat
Parameters
collectionView
The collection view
collectionViewLayout
The layout
section
A section index
Return Value
The desired spacing between columns in the section
-
The height for the item at the given indexPath (Priority 2)
Declaration
Swift
@objc optional func collectionView(_ collectionView: CollectionView, layout collectionViewLayout: CollectionViewLayout, heightForItemAt indexPath: IndexPath) -> CGFloat
Parameters
collectionView
The collection view the item is in
collectionViewLayout
The CollectionViewLayout
indexPath
The indexPath for the item
Return Value
The height for the item
-
The aspect ration for the item at the given indexPath (Priority 1). Width and height must be greater than 0.
Declaration
Swift
@objc optional func collectionView(_ collectionView: CollectionView, layout collectionViewLayout: CollectionViewLayout, aspectRatioForItemAt indexPath: IndexPath) -> CGSize
Parameters
collectionView
The collection view the item is in
collectionViewLayout
The CollectionViewLayout
indexPath
The indexPath for the item
Return Value
The aspect ration for the item
-
Asks the delegate for the height of the header in the given section
Declaration
Swift
@objc optional func collectionView(_ collectionView: CollectionView, layout collectionViewLayout: CollectionViewLayout, heightForHeaderInSection section: Int) -> CGFloat
Parameters
collectionView
The collection view
collectionViewLayout
The layout
section
A section index
Return Value
The desired header height or 0 for no header
-
Asks the delegate for the height of the footer in the given section
Declaration
Swift
@objc optional func collectionView(_ collectionView: CollectionView, layout collectionViewLayout: CollectionViewLayout, heightForFooterInSection section: Int) -> CGFloat
Parameters
collectionView
The collection view
collectionViewLayout
The layout
section
A section index
Return Value
The desired footer height or 0 for no footer