iOS 11 by Tutorials by By the raywenderlich.com Tutorial Team

iOS 11 by Tutorials by By the raywenderlich.com Tutorial Team

Author:By the raywenderlich.com Tutorial Team
Language: eng
Format: epub
Publisher: Ray Wenderlich


Note: Again, you may get a compiler error complaining that park does not conform to NSItemProviderReading. As before, you may need to restart Xcode. The build actually succeeds but the error may still be flagged in the Xcode source editor window.

Animating drag & drop

You’re now successfully dragging and dropping a park between two apps, though the visuals leave something to be desired.

When you drop, there’s no indication anything has happened until the data suddenly appears after a delay. If you cancel a drag outside of a drop area by lifting your finger, the preview expands out from the touch point, and disappears. These behaviors kill the illusion that you’ve actually dragged the park from one area to another.

Fortunately, UIDragInteractionDelegate and UIDropInteractionDelegate have you covered! Here’s a high-level look at the delegate calls involved in animation, and the order in which they act.

First, the UIDragInteractionDelegate side triggers:

dragInteraction(_:previewForLifting:session:) lets you provide a preview for the dragged item.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.