Search code examples
xcodemacosswiftnsviewcontroller

dismiss nsviewcontroller swift doesn't work


That's the button action:

    @IBAction func readyPressed(sender: NSButton) {

    self.dismissController(Hardness)
    println(1)
    self.performSegueWithIdentifier("manual", sender: self)
    }

When I press the button, println works, segue works, but NSViewController "Hardness" doesn't close


Solution

  • Please try using

    self.dismissViewControllerAnimated(true, completion: {});

    or use

    navigationController.popViewControllerAnimated(true)

    as presented here

    how to dismiss a view controller in swift