Skip to content

UICollectionViewCell: isHighlighted property ​

The isHighlighted property indicates whether a finger is currently pressing this item.

Value ​

A boolean.

ValueMeaning
trueThis item looks pressed
falseIt doesn't
  • Readable and writable.
  • The default value is false (measured).
  • The collection view maintains it; you usually don't write it. To select an item, use the collection view's selectItemAtIndexPath().
  • There is no separate change event. Learn about selection changes from the collection view's itemselect and itemdeselect.

Examples ​

js
/** @param {UICollectionViewListCell} cell */
function inspect(cell) {
  console.log(cell.isHighlighted);
}

Result: calling inspect(cell) on a freshly obtained cell logs false.

Corresponding iOS API ​

UICollectionViewCell.highlighted (the getter is isHighlighted).

See also ​