Instance Method

collectionView:canHandleDropSession:

Asks your delegate whether the collection view can accept a drop with the specified type of data.

Declaration

- (BOOL)collectionView:(UICollectionView *)collectionView canHandleDropSession:(id<UIDropSession>)session;

Parameters

collectionView

The collection view that is attempting to handle the drop.

session

The drop session object containing information about the type of data being dragged.

Return Value

YES if the collection view can accept the dragged data or NO if it cannot.

Discussion

Implement this method when you want to dynamically determine whether to accept dropped data in your collection view. In your implementation, check the type of the dragged data and return a Boolean value indicating whether you can accept the drop. For example, you might call the hasItemsConformingToTypeIdentifier: method of the session object to determine whether it contains data that your app can accept.

If you do not implement this method, the collection view assumes a return value of YES. If you return NO from this method, the collection view does not call any more methods of your drop delegate for the given session.