Contents

UICollectionLayoutListConfiguration

A configuration for creating a list layout.

Declaration

@interface UICollectionLayoutListConfiguration : NSObject

Overview

Use this configuration to create a list section for a compositional layout (UICollectionViewCompositionalLayout), or a layout containing only list sections. The following example shows how to create a compositional layout that contains only list sections by applying the same configuration to each section in the list layout:

UICollectionLayoutListConfiguration *configuration = [[UICollectionLayoutListConfiguration alloc] initWithAppearance:UICollectionLayoutListAppearanceSidebar];
UICollectionViewCompositionalLayout *layout = [UICollectionViewCompositionalLayout layoutWithListConfiguration:configuration];

To implement different list configurations for different sections, use a compositional layout’s section provider to create each section with its own list configuration.

UICollectionViewCompositionalLayout *layout = [[UICollectionViewCompositionalLayout alloc] initWithSectionProvider:^NSCollectionLayoutSection *(NSInteger sectionIndex, id<NSCollectionLayoutEnvironment> layoutEnvironment) {
    UICollectionLayoutListConfiguration *configuration = [[UICollectionLayoutListConfiguration alloc] initWithAppearance:UICollectionLayoutListAppearanceInsetGrouped];
    UICollectionLayoutListHeaderMode mode = (sectionIndex == 0) ? UICollectionLayoutListHeaderModeSupplementary : UICollectionLayoutListHeaderModeNone;
    [configuration setHeaderMode:mode];
    NSCollectionLayoutSection *section = [NSCollectionLayoutSection sectionWithListConfiguration:configuration layoutEnvironment:layoutEnvironment];
    return section;
}];

Topics

Creating a list layout configuration

Configuring appearance

Configuring separators

Configuring headers and footers

Customizing swipe actions

Managing content-hugging behavior

See Also

Related Documentation

Creating a list layout