CollectionReusableView

open class CollectionReusableView : NSView

The CollectionReusableView class defines the behavior for all cells and supplementary views presented by a collection view. Reusable views are so named because the collection view places them on a reuse queue rather than deleting them when they are scrolled out of the visible bounds. Such a view can then be retrieved and repurposed for a different set of content.

  • A string that identifies the purpose of the view.

    Declaration

    Swift

    open internal(set) var reuseIdentifier: String?
  • The collection view the view was dequed in

    Declaration

    Swift

    open internal(set) weak var collectionView: CollectionView?
  • True if the view has been dequed from the reuse pool

    Declaration

    Swift

    open internal(set) var reused: Bool
  • Performs any clean up necessary to prepare the view for use again.

    Declaration

    Swift

    override open func prepareForReuse()
  • Called just before the view is added to the collection view

    Declaration

    Swift

    open func viewWillDisplay()
  • Called just after the view was added to the collection view

    Declaration

    Swift

    open func viewDidDisplay()
  • The background color of the cell

    Declaration

    Swift

    open var backgroundColor: NSColor? { get set }
  • Applies the specified layout attributes to the view.

    Declaration

    Swift

    open func apply(_ layoutAttributes: CollectionViewLayoutAttributes, animated: Bool)

    Parameters

    layoutAttributes

    The layout attributes to apply

    animated

    If the collection view is performing an animated update while applying these attributes

  • Disable tracking (used for highlighting in cells) for this view

    Declaration

    Swift

    open func disableTracking()
  • Enable tracking for this view (called by default for cells)

    Declaration

    Swift

    open func enableTracking()