Instance Method

collectionView:canDragItemsAtIndexes:withEvent:

Returns a Boolean indicating whether the collection view can begin dragging the specified items.

Declaration

- (BOOL)collectionView:(NSCollectionView *)collectionView canDragItemsAtIndexes:(NSIndexSet *)indexes withEvent:(NSEvent *)event;

Parameters

collectionView

The collection view containing the items to be dragged.

indexes

The indexes of the items to be dragged.

event

The mouse event that initiated the drag action.

Return Value

YES if the collection view can begin the drag operation for the specified items or NO if it cannot.

Discussion

Implement this method when you want selective control over the initiation of drag operations. In your implementation, use the provided information to determine whether the drag operation should occur and return the appropriate return value. For example, you might return NO if your interface does not allow the user to drag the specified items.

If you do not implement this method in your delegate object, the collection view assumes a return value of YES and begins the drag operation.

See Also

Legacy Collection View Support

- collectionView:pasteboardWriterForItemAtIndex:

Provides the pasteboard writer for the item at the specified index

- collectionView:writeItemsAtIndexes:toPasteboard:

Invoked after it has been determined that a drag should begin, but before the drag has been started.

Deprecated
- collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexes:

Invoked to return an array of filenames that the receiver promises to create.

Deprecated
- collectionView:draggingImageForItemsAtIndexes:withEvent:offset:

Creates and returns a drag image to represent the specified items during a drag.

- collectionView:draggingSession:willBeginAtPoint:forItemsAtIndexes:

Notifies your delegate that a drag session is about to begin.

- collectionView:validateDrop:proposedIndex:dropOperation:

Validates the specified location to see if it is a valid drop target.

- collectionView:acceptDrop:index:dropOperation:

Invoked when the mouse is released over a collection view that previously allowed a drop.