Instance Method

collectionView:shouldBeginMultipleSelectionInteractionAtIndexPath:

Asks the delegate whether the user can select multiple items using a two-finger pan gesture in a collection view.

Declaration

- (BOOL)collectionView:(UICollectionView *)collectionView shouldBeginMultipleSelectionInteractionAtIndexPath:(NSIndexPath *)indexPath;

Parameters

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

YES to allow the user to select multiple items using a two-finger pan gesture; otherwise, NO to disable the behavior. The default value is NO.

Discussion

If you return YES, the system sets the allowsMultipleSelection property to YES. This allows the user to 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.

See Also

Managing the Selected Cells

Changing the Appearance of Selected and Highlighted Cells

Provide visual feedback to the user about the state of a cell and the transition between states.

Selecting Multiple Items with a Two-Finger Pan Gesture

Accelerate user selection of multiple items using the multiselect gesture on table and collection views.

- collectionView:shouldSelectItemAtIndexPath:

Asks the delegate if the specified item should be selected.

- collectionView:didSelectItemAtIndexPath:

Tells the delegate that the item at the specified index path was selected.

- collectionView:shouldDeselectItemAtIndexPath:

Asks the delegate if the specified item should be deselected.

- collectionView:didDeselectItemAtIndexPath:

Tells the delegate that the item at the specified path was deselected.

- collectionView:didBeginMultipleSelectionInteractionAtIndexPath:

Tells the delegate when the user starts using a two-finger pan gesture to select multiple items in a collection view.

- collectionViewDidEndMultipleSelectionInteraction:

Tells the delegate when the user stops using a two-finger pan gesture to select multiple items in a collection view.