Olexiy  Pyvovarov
Olexiy Pyvovarov

Reputation: 890

Popover close event

Thought popovers will be easy :(

In storyboard create two ViewControllers: GraphicalViewController and SettingsViewContoller

On GraphicalViewController I put a button and make an action to SettingsViewController with segue: Popover.

I try to implement method that will react on dismiss of popover:

class settingsViewController: UIViewController, UIPopoverPresentationControllerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        if let popover = popoverPresentationController? {
            println("delegate test") // Works
            popover.delegate = self
        }
    }

    func popoverPresentationControllerDidDismissPopover(popoverPresentationController: UIPopoverPresentationController) {
        println("close test") // Doesn't work when I tap outside popover
    }

}

What's wrong with didDismissPopover?

Upvotes: 0

Views: 835

Answers (1)

Sbhklr
Sbhklr

Reputation: 2703

This should work. I have the exact same setup as you have and this works. Make sure you have set iOS 8 as the deployment target and base SDK.

Upvotes: 2

Related Questions