collectionView(_:shouldBeginMultipleSelectionInteractionAt:)
Asks the delegate whether the user can select multiple items using a two-finger pan gesture in a collection view.
Declaration
optional func collectionView(_ collectionView: UICollectionView, shouldBeginMultipleSelectionInteractionAt indexPath: IndexPath) -> BoolParameters
- collectionView:
The collection view calling this method.
- indexPath:
The index path of the item that the user touched to start the two-finger pan gesture.
Return Value
true to allow the user to select multiple items using a two-finger pan gesture; otherwise, false to disable the behavior. The default value is false.
Discussion
When the system recognizes a two-finger pan gesture, it calls this method before it sets isEditing to true. If you return true from this method, the user can select multiple items using a two-finger pan gesture.
Users can select multiple items using the two-finger pan gesture on collection views that scroll either horizontally or vertically, but not both. Collection views that scroll in both directions won’t recognize the gesture or call this method.
If you don’t implement this method, the system uses the value of allowsMultipleSelectionDuringEditing to determine whether a user can select multiple items using a pan gesture.
See Also
Managing the selected cells
Changing the appearance of selected and highlighted cellsSelecting multiple items with a two-finger pan gesturecollectionView(_:shouldSelectItemAt:)collectionView(_:didSelectItemAt:)collectionView(_:shouldDeselectItemAt:)collectionView(_:didDeselectItemAt:)collectionView(_:didBeginMultipleSelectionInteractionAt:)collectionViewDidEndMultipleSelectionInteraction(_:)