In my application I have a presentViewController
, and inside it I have a button that opens a popover. In this popover I have a barButtonItem to save de data of this popover. I would like that when the user taps outside of the popover, the data could be saved too.
I've tried to use the popoverControllerDidDismissPopover
method in the presentViewController
view. I have the delegate but when I tap outside of the popover this method is not called.
What can I do?
Thanks!!
I had the same issue. You will need to retain the popover object, that way the delegate method gets called. Its strange but it works.
Add this line of code while adding popOver:
Also register popOverDelegate in .h file where u present your popOver COntroller
You probably already solved it, but I just faced the same problem. I'm holding a instance of
UIPopoverController
in my Viewcontroller and had it this way:of course this doesn't work because I'm initializing the
UIPopoverController
AFTER setting the delegate, which overrides the delegate setting. So the correct way is to FIRST initialize the UIPopovercontroller and THEN setting the delegateMaybe you are reinitializing your
UIPopoverController
somewhere - just set the delegate again after reinitializing.I had the same problem and I solved it by handling it different for iOS8.
Presentation code
Delegate calls
I know this questions is old but hopefully it helps someone out there...
The issue is in the initialization of your popover controller. If you have established the popover segue in the storyboard you need to have a reference to this popover in order for the delegate to be called when it is dismissed.
In your prepare for segue method:
Instead of:
You need:
Then make sure to correctly handle if the when the popover should appear in