I want to share some data (an array of custom objects) from different ViewController, when tab changed.
1 = TabController
2 = ViewController
3 = ViewController
4 = SplitViewController
5 = MapView
6 = ViewController
7 = TableViewController
I want to share data between: 7 to 3, 7 to 2
What is the best way to do this?
What's the
data
?A string?NSNotification
is best.A few data?Save to NSUserDefaults.A lot of data?Save to file and read it. Here is example code for find vc along view controller chain:Another simple solution is creating a view bag to hold data to be shared between VC:
You could do something like this:
Usage: