Dismissing UIPopoverController with -dismissPopoverAnimated: won't call delegate?

天大地大妈咪最大 提交于 2019-12-03 11:41:11

That's normal, expected behavior.

Quoting the Apple docs on popoverControllerDidDismissPopover::

The popover controller does not call this method in response to programmatic calls to the dismissPopoverAnimated: method. If you dismiss the popover programmatically, you should perform any cleanup actions immediately after calling the dismissPopoverAnimated: method.

Programmatically the popoverControllerDidDismissPopover does not get called and won't dismissed, you'll have to call the delegate yourself:

[self.PopUp dismissPopoverAnimated:YES];
[self.PopUp.delegate popoverControllerDidDismissPopover:self.PopUp];

Where PopUp is the parent UIPopoverController

Hope this helps

Cheers Al

set the delegate first;

yourPopup.delegate=self;

then some where in your code (May be in Particular Method call due some event). use the following code;

[self.yourPopUp dismissPopoverAnimated:YES];

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!