Interface UICollectionViewDropDelegate


  • public interface UICollectionViewDropDelegate
    • Method Detail

      • collectionViewCanHandleDropSession

        default boolean collectionViewCanHandleDropSession​(UICollectionView collectionView,
                                                           UIDropSession session)
        If NO is returned no further delegate methods will be called for this drop session. If not implemented, a default value of YES is assumed.
      • collectionViewDropPreviewParametersForItemAtIndexPath

        default UIDragPreviewParameters collectionViewDropPreviewParametersForItemAtIndexPath​(UICollectionView collectionView,
                                                                                              NSIndexPath indexPath)
        Allows customization of the preview used for the item being dropped. If not implemented or if nil is returned, the entire cell will be used for the preview. This will be called as needed when animating drops via -[UICollectionViewDropCoordinator dropItem:toItemAtIndexPath:] (to customize placeholder drops, please see UICollectionViewDropPlaceholder.previewParametersProvider)
      • collectionViewDropSessionDidEnd

        default void collectionViewDropSessionDidEnd​(UICollectionView collectionView,
                                                     UIDropSession session)
        Called when the drop session completed, regardless of outcome. Useful for performing any cleanup.
      • collectionViewDropSessionDidEnter

        default void collectionViewDropSessionDidEnter​(UICollectionView collectionView,
                                                       UIDropSession session)
        Called when the drop session begins tracking in the collection view's coordinate space.
      • collectionViewDropSessionDidExit

        default void collectionViewDropSessionDidExit​(UICollectionView collectionView,
                                                      UIDropSession session)
        Called when the drop session is no longer being tracked inside the collection view's coordinate space.
      • collectionViewDropSessionDidUpdateWithDestinationIndexPath

        default UICollectionViewDropProposal collectionViewDropSessionDidUpdateWithDestinationIndexPath​(UICollectionView collectionView,
                                                                                                        UIDropSession session,
                                                                                                        NSIndexPath destinationIndexPath)
        Called frequently while the drop session being tracked inside the collection view's coordinate space. When the drop is at the end of a section, the destination index path passed will be for a item that does not yet exist (equal to the number of items in that section), where an inserted item would append to the end of the section. The destination index path may be nil in some circumstances (e.g. when dragging over empty space where there are no cells). Note that in some cases your proposal may not be allowed and the system will enforce a different proposal. You may perform your own hit testing via -[UIDropSession locationInView]
      • collectionViewPerformDropWithCoordinator

        void collectionViewPerformDropWithCoordinator​(UICollectionView collectionView,
                                                      UICollectionViewDropCoordinator coordinator)
        Called when the user initiates the drop. Use the dropCoordinator to specify how you wish to animate the dropSession's items into their final position as well as update the collection view's data source with data retrieved from the dropped items. If the supplied method does nothing, default drop animations will be supplied and the collection view will revert back to its initial pre-drop session state.