indexPathsToInsertForSupplementaryView(ofKind:)
Retrieves an array of index paths for the supplementary views you want to add to the layout.
Declaration
func indexPathsToInsertForSupplementaryView(ofKind elementKind: String) -> [IndexPath]Parameters
- elementKind:
The specific type of supplementary view.
Return Value
An array of NSIndexPath objects indicating the location of the new supplementary views, or an empty array if you don’t want to add any supplementary views.
Discussion
The collection view calls this method whenever you add cells or sections to the collection view. Implementing this method gives your layout object an opportunity to add new supplementary views to complement the additions.
The collection view calls this method between its calls to prepare(forCollectionViewUpdates:) and finalizeCollectionViewUpdates().
See Also
Responding to collection view updates
prepare(forCollectionViewUpdates:)finalizeCollectionViewUpdates()indexPathsToInsertForDecorationView(ofKind:)initialLayoutAttributesForAppearingItem(at:)initialLayoutAttributesForAppearingSupplementaryElement(ofKind:at:)initialLayoutAttributesForAppearingDecorationElement(ofKind:at:)indexPathsToDeleteForSupplementaryView(ofKind:)indexPathsToDeleteForDecorationView(ofKind:)finalLayoutAttributesForDisappearingItem(at:)finalLayoutAttributesForDisappearingSupplementaryElement(ofKind:at:)finalLayoutAttributesForDisappearingDecorationElement(ofKind:at:)targetIndexPath(forInteractivelyMovingItem:withPosition:)