Interface UICollectionViewDragDelegate


  • public interface UICollectionViewDragDelegate
    API-Since: 11.0
    • Method Detail

      • collectionViewDragPreviewParametersForItemAtIndexPath

        @Nullable
        default @Nullable UIDragPreviewParameters collectionViewDragPreviewParametersForItemAtIndexPath​(@NotNull
                                                                                                        @NotNull UICollectionView collectionView,
                                                                                                        @NotNull
                                                                                                        @NotNull NSIndexPath indexPath)
        Allows customization of the preview used for the item being lifted from or cancelling back to the collection view. If not implemented or if nil is returned, the entire cell will be used for the preview.
      • collectionViewDragSessionAllowsMoveOperation

        default boolean collectionViewDragSessionAllowsMoveOperation​(@NotNull
                                                                     @NotNull UICollectionView collectionView,
                                                                     @NotNull
                                                                     @NotNull UIDragSession session)
        Controls whether move operations (see UICollectionViewDropProposal.operation) are allowed for the drag session. If not implemented this will default to YES.
      • collectionViewDragSessionDidEnd

        default void collectionViewDragSessionDidEnd​(@NotNull
                                                     @NotNull UICollectionView collectionView,
                                                     @NotNull
                                                     @NotNull UIDragSession session)
        Called to signal the end of the drag session.
      • collectionViewDragSessionIsRestrictedToDraggingApplication

        default boolean collectionViewDragSessionIsRestrictedToDraggingApplication​(@NotNull
                                                                                   @NotNull UICollectionView collectionView,
                                                                                   @NotNull
                                                                                   @NotNull UIDragSession session)
        Controls whether the drag session is restricted to the source application. If YES the current drag session will not be permitted to drop into another application. If not implemented this will default to NO.
      • collectionViewDragSessionWillBegin

        default void collectionViewDragSessionWillBegin​(@NotNull
                                                        @NotNull UICollectionView collectionView,
                                                        @NotNull
                                                        @NotNull UIDragSession session)
        Called after the lift animation has completed to signal the start of a drag session. This call will always be balanced with a corresponding call to -collectionView:dragSessionDidEnd:
      • collectionViewItemsForAddingToDragSessionAtIndexPathPoint

        @NotNull
        default @NotNull NSArray<? extends UIDragItem> collectionViewItemsForAddingToDragSessionAtIndexPathPoint​(@NotNull
                                                                                                                 @NotNull UICollectionView collectionView,
                                                                                                                 @NotNull
                                                                                                                 @NotNull UIDragSession session,
                                                                                                                 @NotNull
                                                                                                                 @NotNull NSIndexPath indexPath,
                                                                                                                 CGPoint point)
        Called to request items to add to an existing drag session in response to the add item gesture. You can use the provided point (in the collection view's coordinate space) to do additional hit testing if desired. If not implemented, or if an empty array is returned, no items will be added to the drag and the gesture will be handled normally.
      • collectionViewItemsForBeginningDragSessionAtIndexPath

        @NotNull
        @NotNull NSArray<? extends UIDragItem> collectionViewItemsForBeginningDragSessionAtIndexPath​(@NotNull
                                                                                                     @NotNull UICollectionView collectionView,
                                                                                                     @NotNull
                                                                                                     @NotNull UIDragSession session,
                                                                                                     @NotNull
                                                                                                     @NotNull NSIndexPath indexPath)
        Provide items to begin a drag associated with a given indexPath. If an empty array is returned a drag session will not begin.