I have code in my app that adds a UIView to the root view controller’s view. This view is semi-transparent, and functions as a modal overlay that covers the entire application (the view contains a button that when clicked removes the view from its superview, which is how the user gets back to the main application).
This has worked fine up to now, but now we’re using UIPopoverControllers and attempting to use this same modal overlay to block the main application. The problem is that this UIView is shown behind the popover, instead of on top of it.
Is there any way to add a subview to a root view controller’s view in such a way that it appears on top of any visible UIPopoverControllers, but without dismissing them?
The reference on UIPopoverController states:
NSLogging of the subviews-array shows, that the view is not added to the view hierarchy of the viewController that displays it. From my point of view what you are trying to do isn’t possible.
Here is an idea though:
You could add your blocking UIView to the contentViewController of the UIPopOverController and use it to set a property on the contentViewController.
Then you set your main viewController, which actually displays the UIPopoverController, as delegate of the popover and do something like this:
I don’t know how much this helps in your current situation, but maybe it gets you started.