As @Anoop stated, you can usually only have one popover showing at a time.
One possible solution is to check the contentViewController
property on the pop over. If you are storing a reference of each view controller you could do something like:
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
if ( popoverController.contentViewController == self.someUIViewController ) {
}
else if ( popoverController.contentViewController == someoTherViewController ) {
}
NSLog(@"Popover dismised %@", popoverController);
}
If storing a reference to each content view controller is not possible (or maybe just not a good idea), you could always check its type:
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
if ( [popoverController.contentViewController isKindOfClass:[MyAwesomeViewController class]] ) {
}
else if ( [popoverController.contentViewController isKindOfClass:[MyOtherViewController class]] ) {
}
NSLog(@"Popover dismised %@", popoverController);
}
Another possible solution, which is probably better from a design stand point of view, would be to pass in a delegate to the view controller contained in the pop over. More here. This way, the view controller displayed can send data back to your main view controller.
UIPopOverController
with blocks? This way you wouldn't have to care about that. – Rui Peres