1

As what I said above. I encountered a problem that I have to dismiss the popover on screen while I don't know where it come from.

What I want to do is : when the app become inactive, I want to dismiss the popover. But I don't know where the popover is presented, and which controller is responds to it?

Is there a notification which I could listen to when the UIPopover is presented?

Or can I find the Popover on the screen?

Thank you guys.

soso
  • 28
  • 6
  • This SO Question might answer: http://stackoverflow.com/a/2687793/111823 –  Mar 11 '12 at 12:32
  • You can check this SO question: http://stackoverflow.com/questions/6693837/how-to-dismiss-uiactionsheets-and-uipopovercontrollers-without-knowing-who-prese – aslı Mar 13 '12 at 12:11

1 Answers1

0

Just subclass your own implementation of UIPopoverController and overridepresentPopoverFromRect:inView:permittedArrowDirections:animated and presentPopoverFromBarButtonItem:permittedArrowDirections:animated and keep track of popover references in a global array. Since Apple's HIG says only one popover is allowed at a time on screen, you only need to track the last one.

overboming
  • 1,502
  • 1
  • 18
  • 36
  • Thank you for your answer, that will be a good solution for my problem , and when you mentioned "keep track of popover references", did you mean post a notification ? btw, if I need to subclass UIPopoverController, I have to change all class and have to tell others to use my subclass instead of the official class. – soso Mar 12 '12 at 01:14