Search code examples
ioscocoa-touchuipopovercontrollerpresentmodalviewcontrolleruipopover

Prevent popovers from displaying over presented views


I am attempting to display a passcode screen that appears after X amount of inactivity. I use presentViewController:animated:completion: on the root view controller, and it works as expected, except when a popover is already being displayed. The popover, displayed from a bar button item, appears over the presented passcode screen.

Is there a way to dismiss or hide all visible popovers when presenting a view controller?


Solution

  • Create and add a 2nd window over the first. Present the passcode screen in the 2nd window. This will allow it to appear over any and all views from the first window. When you dismiss the passcode screen, be sure to remove the new window and make the 1st one key again.