views:

17

answers:

2

My program has four PopOverControllers. How can I make sure that when i open one of them the other three are closed?

A: 

2 possible methods.

Create a controller style object 'parent' for the 4 popoverControllers that knows about the four POC's and can drop the other 3 when the 4th comes up in a radio-button style algorithm.

or a variant.

Spit out a notification when you raise a popover so a listener can again drop the other 3.

But a query, why do you have 4 popoverControllers. Id recycle one per viewController.

Warren Burton
If I use only 1 PopOverController then I can't keep the state of the controls in those views eg. an UISwitch in one of the views
Fasid
That's got nothing to do with the POC ,your view isn't your data. If you need to persist you can set state in 'viewDidAppear' for the relevant view controller
Warren Burton
A: 

If you make the detail side the delegate for the UISplitViewController, you can keep track of the most-recently showed UIPopoverController and dismiss it before a new one gets shown when splitViewController:popoverController:willPresentViewController: is called.

Shaggy Frog