Package apple.uikit.protocol
Interface UIDropInteractionDelegate
-
public interface UIDropInteractionDelegateAPI-Since: 11.0
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default booleandropInteractionCanHandleSession(@NotNull UIDropInteraction interaction, @NotNull UIDropSession session)Return whether the delegate is interested in the given session.default voiddropInteractionConcludeDrop(@NotNull UIDropInteraction interaction, @NotNull UIDropSession session)Called when the user has dropped onto this interaction's view, after `-dropInteraction:performDrop:` has been called, and all resulting drop animations have completed.default voiddropInteractionItemWillAnimateDropWithAnimator(@NotNull UIDropInteraction interaction, @NotNull UIDragItem item, @NotNull UIDragAnimating animator)Called when the drop animation is about to start, once for each item, whether it is visible or not.default voiddropInteractionPerformDrop(@NotNull UIDropInteraction interaction, @NotNull UIDropSession session)Called when the user drops onto this interaction's view.default @Nullable UITargetedDragPreviewdropInteractionPreviewForDroppingItemWithDefault(@NotNull UIDropInteraction interaction, @NotNull UIDragItem item, @NotNull UITargetedDragPreview defaultPreview)Called when the drop happens, after `-dropInteraction:performDrop:`, once for each visible item.default voiddropInteractionSessionDidEnd(@NotNull UIDropInteraction interaction, @NotNull UIDropSession session)When the drag session ends, for any reason, this method will be called for *every* interaction that ever received `-dropInteraction:sessionDidEnter:`, `-dropInteraction:sessionDidUpdate:`, or `-dropInteraction:sessionDidExit:`.default voiddropInteractionSessionDidEnter(@NotNull UIDropInteraction interaction, @NotNull UIDropSession session)Called when a drag enters the view.default voiddropInteractionSessionDidExit(@NotNull UIDropInteraction interaction, @NotNull UIDropSession session)Called when the drag has exited the interaction's view.default @NotNull UIDropProposaldropInteractionSessionDidUpdate(@NotNull UIDropInteraction interaction, @NotNull UIDropSession session)Called when the drag enters the interaction's view, or when when the drag moves while inside the view, or if items are added to the drag while inside the view.
-
-
-
Method Detail
-
dropInteractionCanHandleSession
default boolean dropInteractionCanHandleSession(@NotNull @NotNull UIDropInteraction interaction, @NotNull @NotNull UIDropSession session)Return whether the delegate is interested in the given session. If this method is not implemented, or if it returns true, then the other delegate methods will be called, starting with `-dropInteraction:sessionDidEnter:`. If it returns false, this interaction will ignore this session. (We may ask again if something significant about the session changes, like the items in it.) Note that returning true does not mean that the delegate definitely *will* accept this drop, just that it *might* want to accept the drop. To accept it, you must also implement `-dropInteraction:sessionDidUpdate:` and return a UIDropProposal with an appropriate operation. This method is commonly used to check whether the session contains any items that this delegate can consume. Use `UIDropSession`'s convenience methods `-hasItemsConformingToTypeIdentifiers:`, `-canLoadObjectsOfClass:`, etc.
-
dropInteractionConcludeDrop
default void dropInteractionConcludeDrop(@NotNull @NotNull UIDropInteraction interaction, @NotNull @NotNull UIDropSession session)Called when the user has dropped onto this interaction's view, after `-dropInteraction:performDrop:` has been called, and all resulting drop animations have completed. The delegate should cause the interaction's view to draw in its final post-drop state.
-
dropInteractionItemWillAnimateDropWithAnimator
default void dropInteractionItemWillAnimateDropWithAnimator(@NotNull @NotNull UIDropInteraction interaction, @NotNull @NotNull UIDragItem item, @NotNull @NotNull UIDragAnimating animator)Called when the drop animation is about to start, once for each item, whether it is visible or not. Use the animator to animate your own changes alongside the system animation.
-
dropInteractionPerformDrop
default void dropInteractionPerformDrop(@NotNull @NotNull UIDropInteraction interaction, @NotNull @NotNull UIDropSession session)Called when the user drops onto this interaction's view. The delegate should now request data from the session's items' item providers. Data may be requested *only* during the scope of this method.
-
dropInteractionPreviewForDroppingItemWithDefault
@Nullable default @Nullable UITargetedDragPreview dropInteractionPreviewForDroppingItemWithDefault(@NotNull @NotNull UIDropInteraction interaction, @NotNull @NotNull UIDragItem item, @NotNull @NotNull UITargetedDragPreview defaultPreview)
Called when the drop happens, after `-dropInteraction:performDrop:`, once for each visible item. Provide a preview to animate the item to where it belongs. We provide `defaultPreview` which would leave the current preview where the item was dropped. You may return: - defaultPreview, to use it as-is - nil, to fade and shrink the drag item in place - [defaultPreview retargetedPreviewWithTarget:] to move the preview to a different target - a UITargetedDragPreview that you create however you like
-
dropInteractionSessionDidEnd
default void dropInteractionSessionDidEnd(@NotNull @NotNull UIDropInteraction interaction, @NotNull @NotNull UIDropSession session)When the drag session ends, for any reason, this method will be called for *every* interaction that ever received `-dropInteraction:sessionDidEnter:`, `-dropInteraction:sessionDidUpdate:`, or `-dropInteraction:sessionDidExit:`. If you were keeping track of the session for any reason, you may now forget it.
-
dropInteractionSessionDidEnter
default void dropInteractionSessionDidEnter(@NotNull @NotNull UIDropInteraction interaction, @NotNull @NotNull UIDropSession session)Called when a drag enters the view.
-
dropInteractionSessionDidExit
default void dropInteractionSessionDidExit(@NotNull @NotNull UIDropInteraction interaction, @NotNull @NotNull UIDropSession session)Called when the drag has exited the interaction's view.
-
dropInteractionSessionDidUpdate
@NotNull default @NotNull UIDropProposal dropInteractionSessionDidUpdate(@NotNull @NotNull UIDropInteraction interaction, @NotNull @NotNull UIDropSession session)
Called when the drag enters the interaction's view, or when when the drag moves while inside the view, or if items are added to the drag while inside the view. You *must* implement this method to accept a drop. Return a `UIDropProposal` that contains the operation that the delegate would like to perform. (Note that you may use `UIDropOperationMove` only if session.allowsMoveOperation is true.) You may also set other properties on the `UIDropProposal` to change the appearance of the drag over this view. Use the session's `-locationInView:` to get a point to use for hit testing.
-
-