The previous section explained how drag and drop works from a theoretical point of view. This section focuses on implementing drag and drop in a sample app. First, you will learn how a simple, regular implementation of drag and drop might work. Next, you'll see how Apple has implemented drag and drop for UICollectionView
and UITableView
. These two components have received special treatment for drag and drop, making it even easier to implement drag and drop in apps that use these components.
Before you implement drag and drop in the Augmented Reality gallery, let's see how you can implement a simple version of drag and drop with a simple view and an image. In the code bundle for this chapter, you'll find a sample project named PlainDragDrop
. Open the starting version for this project and run it on an iPad simulator. You should see the user interface shown in the following screenshot:
The goal of this example...