Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Swift: The view isn't dismissed when button clicked #5

Open
hadth opened this issue Jul 25, 2014 · 1 comment
Open

In Swift: The view isn't dismissed when button clicked #5

hadth opened this issue Jul 25, 2014 · 1 comment

Comments

@hadth
Copy link

hadth commented Jul 25, 2014

Hi, I don't know if you're still working on this extension but I hope you'll have a look at my problem:
I used this code:

var alert = NSAlert()
                    alert.alertStyle = .WarningAlertStyle
                    alert.messageText = "Error!"
                    alert.runAsPopoverForView(tfInput, withCompletionBlock: {
                        (result : Int) in
                            println("Result: \(result)")
                        }
                        )

tfInput is a NSTextField inside a NSWindow. When I clicked the OK button, the alert view isn't dismissed and the program doesn't jump into the completion block.

@Abushawish
Copy link

Abushawish commented Jul 11, 2018

@hadth I know your question is veryyyyyyy old, but just incase anyone needs to use this. Alongside what you have already, add the actual buttons. Don't rely on the provided button. Do this as so:

alert.addButton(withTitle: "OK")
alert.addButton(withTitle: "Cancel")

P.S. In Swift 4, I had to do this for the alert style:

alert.alertStyle = .warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants