An interaction object that you use to display relevant actions for your content.
- iOS 13.0+
- Mac Catalyst 13.0+
UIContext object to focus the user's attention on a specific portion of your content, and to provide actions for the user to perform on that content. A context menu interaction object tracks Force Touch gestures on devices that support 3D Touch, and long-press gestures on devices that don't support it. When the appropriate gesture occurs, this object animates your content to a new interface and displays the contextual menu that you supplied. UIKit manages all menu-related interactions and reports the selected action, if any, back to your app.
A context menu interaction object inherits from
UIInteraction. After creating the object, assign an appropriate object to its
delegate property and use the
add method to attach it to one of your views. The delegate object you provide must adopt the
UIContext protocol. Use the methods of that object to provide the contents of the contextual menu. Add your context menu interaction object to a view in your interface using the view's