collectionView(_:shouldShowMenuForItemAt:)
Asks the delegate if an action menu should be displayed for the specified item.
Declaration
optional func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath) -> BoolParameters
- collectionView:
The collection view object that is making the request.
- indexPath:
The index path of the affected item.
Return Value
true if the editing menu should be shown positioned near the item and pointing to it or false if it should not.
Discussion
If the user tap-holds a certain item in the collection view, this method (if implemented) is invoked first. Return true if you want to permit the editing menu to be displayed. Return false if the editing menu shouldn’t be shown—for example, you might return false if the corresponding item contains data that should not be copied or pasted over.
If you do not implement this method, the default return value is false.
See Also
Deprecated
collectionView(_:targetIndexPathForMoveFromItemAt:toProposedIndexPath:)collectionView(_:contextMenuConfigurationForItemAt:point:)collectionView(_:previewForDismissingContextMenuWithConfiguration:)collectionView(_:previewForHighlightingContextMenuWithConfiguration:)collectionView(_:canPerformAction:forItemAt:withSender:)collectionView(_:performAction:forItemAt:withSender:)