public interface UIDragInteractionDelegate
| Modifier and Type | Method and Description |
|---|---|
default NSArray<? extends UIDragItem> |
dragInteractionItemsForAddingToSessionWithTouchAtPoint(UIDragInteraction interaction,
UIDragSession session,
CGPoint point)
To allow touches on this view to add items to an existing drag,
implement `-dragInteraction:itemsForAddingToSession:withTouchAtPoint:`.
|
NSArray<? extends UIDragItem> |
dragInteractionItemsForBeginningSession(UIDragInteraction interaction,
UIDragSession session)
Provide items to begin a drag.
|
default void |
dragInteractionItemWillAnimateCancelWithAnimator(UIDragInteraction interaction,
UIDragItem item,
UIDragAnimating animator)
Called when the cancel animation is about to start, once for each item,
whether it is visible or not.
|
default boolean |
dragInteractionPrefersFullSizePreviewsForSession(UIDragInteraction interaction,
UIDragSession session)
Return whether this drag's items' previews should be shown in their full
original size while over the source view.
|
default UITargetedDragPreview |
dragInteractionPreviewForCancellingItemWithDefault(UIDragInteraction interaction,
UIDragItem item,
UITargetedDragPreview defaultPreview)
Called when the drag is cancelled, once for each visible item.
|
default UITargetedDragPreview |
dragInteractionPreviewForLiftingItemSession(UIDragInteraction interaction,
UIDragItem item,
UIDragSession session)
Provide a preview to display while lifting the drag item.
|
default boolean |
dragInteractionSessionAllowsMoveOperation(UIDragInteraction interaction,
UIDragSession session)
Return whether this drag allows the "move" drop operation to happen.
|
default void |
dragInteractionSessionDidEndWithOperation(UIDragInteraction interaction,
UIDragSession session,
long operation)
Called when the user is done dragging and all related animations are
completed.
|
default void |
dragInteractionSessionDidMove(UIDragInteraction interaction,
UIDragSession session)
Called when the drag has moved (because the user's touch moved).
|
default void |
dragInteractionSessionDidTransferItems(UIDragInteraction interaction,
UIDragSession session)
Called after a drop happened and the handler of the drop has received
all of the data that it requested.
|
default UIDragSession |
dragInteractionSessionForAddingItemsWithTouchAtPoint(UIDragInteraction interaction,
NSArray<?> sessions,
CGPoint point)
If there are two or more existing drag sessions, it may not be clear to the user
which session items will be added to.
|
default boolean |
dragInteractionSessionIsRestrictedToDraggingApplication(UIDragInteraction interaction,
UIDragSession session)
Return whether this drag is restricted to only this application.
|
default void |
dragInteractionSessionWillAddItemsForInteraction(UIDragInteraction interaction,
UIDragSession session,
NSArray<? extends UIDragItem> items,
UIDragInteraction addingInteraction)
Similar to -dragInteraction:sessionWillBegin:, but for
items added to an session after it has already begun.
|
default void |
dragInteractionSessionWillBegin(UIDragInteraction interaction,
UIDragSession session)
Called when the the items are in their fully lifted appearance,
and the user has started to drag the items away.
|
default void |
dragInteractionSessionWillEndWithOperation(UIDragInteraction interaction,
UIDragSession session,
long operation)
Called when the user is done dragging, and the drag will finish.
|
default void |
dragInteractionWillAnimateLiftWithAnimatorSession(UIDragInteraction interaction,
UIDragAnimating animator,
UIDragSession session)
Called when the lift animation is about to start.
|
default void dragInteractionItemWillAnimateCancelWithAnimator(UIDragInteraction interaction, UIDragItem item, UIDragAnimating animator)
default NSArray<? extends UIDragItem> dragInteractionItemsForAddingToSessionWithTouchAtPoint(UIDragInteraction interaction, UIDragSession session, CGPoint point)
If the provided session is an appropriate one to use, then return an array of items, just like in `-dragInteraction:itemsForBeginningSession:`. They will be added to the drag session. Afterwards, `-dragInteraction:session:willAddItems:forInteraction:` will be sent to each interaction which has contributed items to the session, including this one.
Otherwise, return an empty array. No items will be added, and the touch will be handled as if the other drag session did not exist.
If this method is not implemented, acts as though an an empty array was returned.
Use the point, in the view's coordinate space, to determine what part of your view has been touched.
NSArray<? extends UIDragItem> dragInteractionItemsForBeginningSession(UIDragInteraction interaction, UIDragSession session)
If these items represent things that are displayed in a linear order (for example, rows in a table), provide them in the same order, first to last.
If an empty array is returned, then no drag will begin.
default boolean dragInteractionPrefersFullSizePreviewsForSession(UIDragInteraction interaction, UIDragSession session)
If not implemented, defaults to false.
default UITargetedDragPreview dragInteractionPreviewForCancellingItemWithDefault(UIDragInteraction interaction, UIDragItem item, UITargetedDragPreview defaultPreview)
default UITargetedDragPreview dragInteractionPreviewForLiftingItemSession(UIDragInteraction interaction, UIDragItem item, UIDragSession session)
default void dragInteractionSessionDidEndWithOperation(UIDragInteraction interaction, UIDragSession session, long operation)
If the operation is UIDropOperationCopy or UIDropOperationMove, then data transfer will begin, and -dragInteraction:sessionDidTransferItems: will be called later.
default void dragInteractionSessionWillAddItemsForInteraction(UIDragInteraction interaction, UIDragSession session, NSArray<? extends UIDragItem> items, UIDragInteraction addingInteraction)
Note that the interaction that is causing the items to be added may be different than the interaction that started the drag. This method is called on the delegates of all interactions that ever added items to this session. `addingInteraction` is the interaction that is causing these new items to be dragged.
default void dragInteractionSessionWillEndWithOperation(UIDragInteraction interaction, UIDragSession session, long operation)
If the operation is UIDropOperationCancel or UIDropOperationForbidden, the delegate should prepare its views to show an appropriate appearance before the cancel animation starts.
default boolean dragInteractionSessionAllowsMoveOperation(UIDragInteraction interaction, UIDragSession session)
If true, then a UIDropInteraction's delegate's -dropInteraction:sessionDidUpdate: may choose to return UIDropOperationMove, and that operation will be provided to -dragInteraction:session:willEndWithOperation: and -dragInteraction:session:didEndWithOperation:.
If not implemented, defaults to true.
default void dragInteractionSessionDidMove(UIDragInteraction interaction, UIDragSession session)
default void dragInteractionSessionDidTransferItems(UIDragInteraction interaction, UIDragSession session)
default UIDragSession dragInteractionSessionForAddingItemsWithTouchAtPoint(UIDragInteraction interaction, NSArray<?> sessions, CGPoint point)
If you *do* want to add the item to a session, implement `-dragInteraction:sessionForAddingItems:withTouchAtPoint:` and return the appropriate session. This should be rare.
To continue without adding items, return nil.
If this method is not implemented, defaults to nil.
default boolean dragInteractionSessionIsRestrictedToDraggingApplication(UIDragInteraction interaction, UIDragSession session)
If true, then the drag will be restricted. Only this application will be able to see the drag, and other applications will not. If the user drops it on another application, the drag will be cancelled.
If false, then the drag is not restricted. Other applications may see the drag, and the user may drop it onto them.
If not implemented, defaults to false.
Note that this method is called only on devices that support dragging across applications.
default void dragInteractionSessionWillBegin(UIDragInteraction interaction, UIDragSession session)
default void dragInteractionWillAnimateLiftWithAnimatorSession(UIDragInteraction interaction, UIDragAnimating animator, UIDragSession session)