0

I want to present view controller modally with horizontal flip transition from view controller that already embedded in navigation controller and then when user press Done button modal view should be dismiss and presenting view controller should be appear.

Presenting view controller modally ok and i do that with code:

@IBAction func openCardPreferences(sender: AnyObject) {
        let newVC = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle()).instantiateViewControllerWithIdentifier("common") as CommonCardParametrsViewController

        self.presentViewController(newVC, animated: true, completion: {
        })
    }

but dismissing modal view controller back me to navigation's controller root view controller, not to "presenting view controller"

@IBAction func applyChanges() {

        println(self.presentingViewController)
       // self.delegate?.doneButtonPressed?()

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

As you may see i trying to dismiss controller with delegate method, but this doesn't resolve my problem.

It is interesting that log self.presentingViewController return UINavigation controller instance.

I don't understand what happened. What i doing wrong?

Nikolai Nagornyi
  • 1,312
  • 2
  • 11
  • 26
  • This code should work fine, for me, it always returns to the `presenting view controller`, which is not the `root view controller` of the `navigation controller`. – gabbler Dec 08 '14 at 09:24

1 Answers1

0

I move method setViewControllers in UINavigationController subclass from viewWillAppear to viewDidLoad and this resolve my problem.

Nikolai Nagornyi
  • 1,312
  • 2
  • 11
  • 26