Recipe: Custom Item Menus

Collection views support menus like the one shown in Figure 10-10, using a standard tap-and-hold gesture. The menu provides cut, copy, and paste actions by default. These default actions can be filtered out and custom actions added to build a menu like the one shown.

Image

Figure 10-10 These custom item-by-item menus require cells to become the first responder.

Menu support is provided through three delegate methods on UICollectionView:

Image collectionView:shouldShowMenuForItemAtIndexPath:Determines whether an item at the specified ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.