Popover popoverControllerDidDismissPopover not called

痴心易碎 提交于 2019-12-13 03:39:37

问题


wi have 2 questions about using a popover in my application. First is about the popoverControllerDidDismissPopover function, it is never called in my application. I checked here about the same topics and found out that normally the problem is that the delegate is not set. But in my case i had:

class MainTableViewController: ...,UIPopoverControllerDelegate {

And to call the modal:

var popover: UIPopoverController!

On my cell tap event

popover = UIPopoverController(contentViewController: popoverContent)
popover.delegate = self
popover.presentPopoverFromRect(currentCell.LabelCellTitle.frame, inView: currentCell.LabelCellTitle.superview, permittedArrowDirections: UIPopoverArrowDirection.Left, animated: true)

The popover appears, but if i tap outside of it the method:

popoverControllerDidDismissPopover

will not be called. Any ideas?

The second question is about an error ill get when i tap on my cell again to load up the popover.

Warning: Attempt to present <...24ModalTableViewController: 0x7fda8a55e440>  on <...23MainTableViewController: 0x7fda8a62eb80> which is already presenting (null)

Ok, i guess that mean that the ModalTableViewController is still there. Do i need it to set to nil with the popoverControllerDidDismissPopover function? Or how do i solve this warning?

Thanks in advance.

Edit:

After cleaning my projekt problem 1 is now solved (little mysterious) - maybe a bug in XCode Beta. Problem 2 still present

Edit2:

If i now set the Content and the Popover to nil after dismiss, i got the following error:

func popoverControllerDidDismissPopover(popoverController: UIPopoverController!) {

    self.popover = nil
    self.popoverContent = nil

}

Application tried to represent an active popover presentation

Why is the popover still active?

来源:https://stackoverflow.com/questions/25199466/popover-popovercontrollerdiddismisspopover-not-called

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