<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/NSCollectionLayoutBoundarySupplementaryItem",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCollectionLayoutBoundarySupplementaryItem"
  },
  "title" : "NSCollectionLayoutBoundarySupplementaryItem"
}
-->

# NSCollectionLayoutBoundarySupplementaryItem

An object used to add headers or footers to a collection view.

```
@MainActor class NSCollectionLayoutBoundarySupplementaryItem
```

## Overview

A boundary supplementary item is a specialized type of supplementary item ([`NSCollectionLayoutSupplementaryItem`](/documentation/UIKit/NSCollectionLayoutSupplementaryItem)). You use boundary supplementary items to add headers or footers to a section of a collection view or the entire collection view.

Each type of supplementary item must have a unique element kind. Consider tracking these strings together in a way that makes it straightforward to identify each element, for example:

```objc
NSString* const ELEMENT_KIND_BADGE = @"badge-element-kind";
NSString* const ELEMENT_KIND_BACKGROUND = @"background-element-kind";
NSString* const ELEMENT_KIND_SECTION_HEADER = @"section-header-element-kind";
NSString* const ELEMENT_KIND_SECTION_FOOTER = @"section-footer-element-kind";
NSString* const ELEMENT_KIND_LAYOUT_HEADER = @"layout-header-element-kind";
NSString* const ELEMENT_KIND_LAYOUT_FOOTER = @"layout-footer-element-kind";
```

Add boundary supplementary items to a section by setting that section’s [`boundarySupplementaryItems`](/documentation/UIKit/NSCollectionLayoutSection/boundarySupplementaryItems) property:

```objc
NSCollectionLayoutSection *section = [NSCollectionLayoutSection sectionWithGroup:group];

NSCollectionLayoutSize *headerFooterSize = [NSCollectionLayoutSize sizeWithWidthDimension:[NSCollectionLayoutDimension fractionalWidthDimension:1.0] heightDimension:[NSCollectionLayoutDimension absoluteDimension:44.0]];

NSCollectionLayoutBoundarySupplementaryItem *sectionHeader = [NSCollectionLayoutBoundarySupplementaryItem boundarySupplementaryItemWithLayoutSize: headerFooterSize elementKind: ELEMENT_KIND_SECTION_HEADER alignment: NSRectAlignmentTop];

NSCollectionLayoutBoundarySupplementaryItem *sectionFooter = [NSCollectionLayoutBoundarySupplementaryItem boundarySupplementaryItemWithLayoutSize: headerFooterSize elementKind: ELEMENT_KIND_SECTION_FOOTER alignment: NSRectAlignmentBottom];

[section setBoundarySupplementaryItems: @[sectionHeader, sectionFooter]];
```

## Topics

### Creating a boundary supplementary item

[`init(layoutSize:elementKind:alignment:)`](/documentation/UIKit/NSCollectionLayoutBoundarySupplementaryItem/init(layoutSize:elementKind:alignment:))

Creates a boundary supplementary item of the specified size and element kind, with an alignment relative to a section or layout.

[`init(layoutSize:elementKind:alignment:absoluteOffset:)`](/documentation/UIKit/NSCollectionLayoutBoundarySupplementaryItem/init(layoutSize:elementKind:alignment:absoluteOffset:))

Creates a boundary supplementary item of the specified size and element kind, with an alignment relative to a section or layout at an absolute offset.

### Specifying scrolling behavior

[`pinToVisibleBounds`](/documentation/UIKit/NSCollectionLayoutBoundarySupplementaryItem/pinToVisibleBounds)

A Boolean value that indicates whether a header or footer is pinned to the top or bottom visible boundary of the section or layout it’s attached to.

### Specifying position

[`offset`](/documentation/UIKit/NSCollectionLayoutBoundarySupplementaryItem/offset)

The floating-point value of the boundary supplementary item’s offset from the section or layout it’s attached to.

[`alignment`](/documentation/UIKit/NSCollectionLayoutBoundarySupplementaryItem/alignment)

The alignment of the boundary supplementary item relative to the section or layout it’s attached to.

[`extendsBoundary`](/documentation/UIKit/NSCollectionLayoutBoundarySupplementaryItem/extendsBoundary)

A Boolean value that indicates whether a boundary supplementary item extends the content area of the section or layout it’s attached to.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)