Swift 3 - how to close one last Popover open on another Popover ?

Asked

Viewed 254 times

0

I have a viewcontroller that opens a Popover. This first opens a second Popover. But when I give a self.Ismiss on any of the popovers is closing all the popovers and the viewcontroller that called it.

I use the following commands to call each Pover:

performSegue(withIdentifier: "callDriverPopupSegue", sender: self)

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
   if segue.identifier == "callDriverPopSegue" {
    let popOver = segue.destination as! CallDriverPopup
    popOver.modalPresentationStyle = .popover
    popOver.popoverPresentationController!.delegate = self
   }
}

To close use:

dismiss(animated: true, completion: nil)

2 answers

1

I have the answer to your problem below, the scenario is different but the solution is same. You have to write the code to close the Popover in the current view controller. Write your code in your dismissVIew method of your controller.

  • var tmpController :Uiviewcontroller! = self.presentingViewController;

    self.dismissViewControllerAnimated(false, completion: {()->Void in
        println("done");
        tmpController.dismissViewControllerAnimated(false, completion: nil);
    });*
    

Example here

0


I found a solution. With the two instructions below I managed to close the open Popover.

    navigationController?.popViewController(animated: true)
    self.dismiss(animated: true, completion: nil)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.