Skip to content

UICollectionView: allowsSelection property ​

The allowsSelection property indicates whether the user can select items in the list.

Value ​

A boolean.

ValueEffect
trueThe user can select items
falseTapping does nothing, and itemselect doesn't fire
  • Readable and writable.
  • Defaults to true.
  • No change event: only the app's own code changes it.

Examples ​

js
const list = new UICollectionView(
  UICollectionViewCompositionalLayout.layoutWithListConfiguration(
    new UICollectionLayoutListConfiguration('insetGrouped')));
list.allowsSelection = false;

Effect: tapping a row does nothing. Not verified in the simulator.

Corresponding iOS API ​

UICollectionView.allowsSelection.

See also ​