One of the biggest problems with popovers is how the delegate's dismiss methods (-[popoverPresentationControllerShouldDismissPopover:]
, -[popoverPresentationControllerDidDismissPopover:]
) are only called if the user dismisses the popover, not if the popover is dismissed programmatically.
There's lots of important code in my dismiss methods that needs to get called. Is there an elegant solution to make sure this code gets called even on programmatic dismissal? (Sure, I can call "should" and "did" every time I dismiss...but that's error-prone and kind of gross.)
Thanks.
I am not aware of a better solution than to manually call it each time you programmatically dismiss it.
[self popoverPresentationControllerDidDismissPopover:self.popoverPresentation];
This is quite common in the iOS SDK. For example, if you programmatically select a row in a table view, the delegate method tableView:didSelectRowAtIndexPath:
will not be called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With