Contents

visibleSupplementaryViews(ofKind:)

Returns an array of the actively managed supplementary views in the collection view.

Declaration

func visibleSupplementaryViews(ofKind elementKind: NSCollectionView.SupplementaryElementKind) -> [any NSView & NSCollectionViewElement]

Parameters

  • elementKind:

    The kind of the supplementary views you want returned. The layout object defines the kinds of supplementary views it supports. This parameter must not be nil.

Return Value

An array of view objects. The returned array may be empty.

Discussion

The views returned by this method represent the ones that are active and are currently being managed by the collection view. The array may contain supplementary views that are outside of the collection view’s actual visible rectangle. For example, it might contain views that were recently visible but have since been scrolled out of the visible rectangle. To test whether a view is actually visible, check to see if its frame rectangle intersects the visibleRect of the collection view.

See Also

Locating Items and Views