derdida
derdida

Reputation: 14904

How to push values to the rootViewController from NavigationController?

I have the following problem:

I would like to pass some data to my rootViewController, from an UINavigationController in an Popover. My popover is here:

var popoverNavigationController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("popoverNavigationController") as! PopoverNavigationController

When ill open that controller with:

popoverController.modalPresentationStyle = UIModalPresentationStyle.Popover
self.presentViewController(popoverController, animated: true, completion: nil)

There is a rootViewcontroller, with a certain class - how could i append data from the NavigationController to its rootViewController?

For example:

popoverController.text = "1234"

How can i push this value to the rootViewController? The NavigationController is initialized by the Storyboard.

Thanks in advance.

enter image description here

Upvotes: 0

Views: 673

Answers (1)

André Slotta
André Slotta

Reputation: 14040

if i got you right in your navigationcontroller you could do something like this:

if let rootViewController = viewControllers.first as? PopoverAddItemsViewController {
  rootViewController.text = "1234"
}

Upvotes: 1

Related Questions