Brian
Brian

Reputation: 1391

How do I detect that a popover has finished?

In my OS X app built with Swift, I show a popover when the user is not logged in. The user logs in via the popover. How do I then detect at the view controller that launched the popover that the popover has been dismissed?

Upvotes: 0

Views: 506

Answers (2)

Christian
Christian

Reputation: 22343

As @Koen mentioned, you should check NSPopoverDidCloseNotification and call a method, if the popover did close:

NSNotificationCenter.defaultCenter().notificationCenter.addObserver(
    self,
    selector: "popOverClosed:",
    name:NSPopoverDidCloseNotification,
    object: nil
)

That way the popOverClosed method gets called everytime the popover dismisses.

func popOverClosed(sender : AnyObject) {
    //PopOver Dismissed
}

Upvotes: 1

koen
koen

Reputation: 5729

Listen to the NSPopoverDidCloseNotification notification.

Upvotes: 0

Related Questions