Show a temporary interface on top of your app’s content on iPad.
Use popovers for app content that appears when needed and disappears when the user is finished with it. For example, use popovers to display information about the currently selected item, to display tools and configuration options, or to gather information from the user. You anchor a popover to a specific location onscreen, and the popover floats above the main window. Figure 1 shows how the Calendar app on iPad uses a popover to prompt the user for new meeting information.
You specify the content of a popover using a view controller. You then present your view controller using the popover presentation style. UIKit anchors your popover to the location you specify.
Listing 1 shows how to present a popover from a bar button item, which acts as the anchor point for the popover. UIKit uses the position of that bar button item to determine where to place the popover and how to orient its arrow. The view controller's
UIPopover manages the display of your popover onscreen.
Configure other properties of your view controller's
UIPopover object before calling the
present(_: method. For example, you might want to assign a delegate to manage the presentation and dismissal of the popover.