Search code examples
iosobjective-cuipopovercontroller

UIPopoverPresentationController isVisible equivalent?


UIPopoverController has a .isVisible property to tell if the popover is on the screen or not.

Is there an equivalent for the new UIPopoverPresentationController?


Solution

  • It's a UIPresentationController, so it has a presentedView, so you can ask whether that presentedView has a non-nil window.

    But the real answer is that you are looking completely in the wrong place. UIPopoverPresentationController is nothing like the old UIPopoverController; they have almost nothing in common and they are not managed in similar ways. A popover is now just a presented view controller. Concentrate on the view controller. You just dismiss it, like any presented view controller (self.dismissViewController...). This is the whole point. You no longer retain a reference to anything; you no longer have to manage anything; it's just like presenting and dismissing any modal dialog / view.