SegmentedCollectionViewDelegate
public protocol SegmentedCollectionViewDelegate: AnyObject
A set of methods that your delegate object must implement to interact with the segmented collection view.
A default implementation of the function considered optional exists for objects inheriting from NSObject
.
-
Tells the delegate that the specified item is now selected.
Declaration
Swift
func segmentedCollectionView(_ collectionView: SegmentedCollectionView,
Parameters
collectionView
A
SegmentedCollectionView
object informing the delegate about the new item selection.item
The new selected item.
-
segmentedCollectionView(_:willDisplayHeader:)
Default implementationTells the delegate that the segmented collection view is about to draw its header view.
Default Implementation
Declaration
Swift
func segmentedCollectionView(_ collectionView: SegmentedCollectionView,
Parameters
collectionView
A
SegmentedCollectionView
object informing the delegate of this impending event.header
The header about to be drawn.
-
heightOfHeaderView(in:)
Default implementationAsks the delegate for the height to use for the header view.
Default Implementation
Declaration
Swift
func heightOfHeaderView(in collectionView: SegmentedCollectionView) -> CGFloat
Parameters
collectionView
The
SegmentedCollectionView
object requesting this information.Return Value
A nonnegative floating-point value that specifies the height (in points) that the header view should be.
-
verticalPaddingForItems(in:)
Default implementationAsks the delegate for the size of the vertical padding to use for items.
Default Implementation
Declaration
Swift
func verticalPaddingForItems(in collectionView: SegmentedCollectionView) -> CGFloat
Parameters
collectionView
The
SegmentedCollectionView
object requesting this information.Return Value
A nonnegative floating-point value that specifies the dimension (in points) that the vertical padding of the collection view should be.
-
segmentedCollectionView(_:numberOfColumnsForSection:)
Default implementationAsks the delegate how many columns should be displayed for one of the section of the view.
Default Implementation
Declaration
Swift
func segmentedCollectionView(_ collectionView: SegmentedCollectionView,
Parameters
collectionView
The
SegmentedCollectionView
object requesting this information.section
An index number identifying a section of the collectionView.
Return Value
The number of columns in section.
-
segmentedCollectionView(_:heightForItemWithWidth:forSection:)
Default implementationAsks the delegate for the height to use for a row in a specified location.
Default Implementation
Declaration
Swift
func segmentedCollectionView(_ collectionView: SegmentedCollectionView,
Parameters
collectionView
The
SegmentedCollectionView
object requesting this information.width
The width that will be used for the cell.
section
An index number identifying a section of the collectionView.
Return Value
A nonnegative floating-point value that specifies the height (in points) that the item’s cell should be.