0

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?

derdida
  • 14,784
  • 16
  • 90
  • 139
  • Have you tried implementing `popoverControllerShouldDismissPopover ` and checking if that method is called? If not then it's probably something with the delegate. – Majster Aug 08 '14 at 08:58
  • Yes, done already. But it is also not called after closing. – derdida Aug 08 '14 at 08:59
  • Hmm after cleaning my project it works now fine as expected. Maybe a Bug in the Beta Version of XCode. Can u help me with my second question too? – derdida Aug 08 '14 at 09:01
  • I had the same problem, I solved it with handling it different for iOS8 and higher see this answer http://stackoverflow.com/a/27899994/461864 – Saren Inden Jan 12 '15 at 10:37
  • 1
    Possible duplicate of [popoverControllerDidDismissPopover method is not called](http://stackoverflow.com/questions/12260510/popovercontrollerdiddismisspopover-method-is-not-called) – Brian Tompsett - 汤莱恩 Aug 29 '16 at 20:46

0 Answers0