Context menus in UIKit offer a great way to provide additional actions for a particular view. In this series we will see how we can build dynamic menus, nest menus together, and control the presentation and preview of the menu as it appears.
Length: 42 minutes
Context menus are a great affordance for performing related actions to a UI element. Users can tap and hold to view the context menu, and the gesture is consistent across the OS so users will likely already be familiar with it. In this episode we'll show how to set up a basic context menu with a custom preview with normal and destructive actions.
In this episode we will see how to nest menus inside each other as well as dynamically choosing when to show a nested menus contents inline.
Another common use of context menus is with table views and collection views. In this episode we will explore adding a menu to a table view cell that allows copying a font or toggling it from a favorites list.
Let's see how we can provide a custom view controller to preview when a context menu is opened. This is analogous to (and a replacement for) the Peek/Pop interaction for devices that supported 3D Touch.
Sometimes we need menus to be dynamic, or we need to fetch some data before being able to build out the menu items. In this episode we will see how to leverage UIDeferredMenuElement to fetch some data and build a dynamic menu.