Search code examples
iosuipopovercontroller

Can't present view controller in a UIPopoverController


I have multiple container views embedded into one navigation controller. Now I'm trying to use UIPopoverController to display a view. This view was already presented to the user before - it was in a container view embedded in a navigation controller. If I try to present the view again in a popover I get

Application tried to present modally an active controller

But the view isn't active. It's only somewhere in the navigation controller stack. Does this mean that you can present every view only one time?

Edit:

The structure for this problem looks like the following:

View Controller > Container A (VC1, VC2, VC3) > Container B (VC2, VC4)

Now on Container B VC3 should be presented as a popup. An event is raised on VC2 in Container B (C# event). Container B should present the popup --> The app crashes and I get the above error message.

Now I tried to present the popup directly from VC2. This seems to work. Perhaps it's a problem because I reused the popover instance from Container B. I'll check that out.


Solution

  • Now I created a new instance of UIPopoverController in Container B where the event is catched. It works as expected and doesn't crash anymore.

    Still don't know why I can't reuse the popover with contentViewController. Or is it because I'm using presentPopoverFromRect and another time presentPopoverFromBarButtonItem?