-1

I would like to pass a bool value from a viewcontroller to navigation controller inside a tabbarcontroller. Because I need to show a different view in accordance to the passed value.

By the way I couldn't pass the value through a code below,

// ViewController 
let navigationVC = self.storyboard?.instantiateViewControllerWithIdentifier("navigation") as! NavigationController 

navigationVC.pass = true

But I couldn't get the value. Is it because a tabbarcontroller between the ViewController and NavigationController?

vcvcvcvc
  • 137
  • 4
  • 10
  • How does storyboard look like: [TabBarController[[ViewController1]->[NavigationController]],[ViewController2][ViewController3]] ? – Bista Sep 07 '16 at 12:12

1 Answers1

0

Use NSUserDefaults then you can reach data all pages For setting,

NSUserDefaults.standardUserDefaults().setBool(true,forKey: "state")

or

NSUserDefaults.standardUserDefaults().setBool(false,forKey: "state")

For accessing

let data = NSUserDefaults.standardUserDefaults().boolForKey("state")
aahmetbas
  • 64
  • 7