1

I have found 2 methods but am wondering if there's a better solution with xcode 5.

  1. How to Pass Data Between iOS Tab bar Using Protocol and delegate
  2. Xcode: Storyboard Tabbed Application Passing Data Back and Forth

Tried printing a NSLog in prepareForSegue but it doesn't even get called?

What is the current best practice to pass data between viewcontrollers for tabbed applications using storyboard and with io6 support?

Community
  • 1
  • 1
resting
  • 16,287
  • 16
  • 59
  • 90

3 Answers3

0

Have a look at this question: iPhone: How to Pass Data Between Several Viewcontrollers in a Tabbar App

Also the imho cleanest way is to use the NSNotificationcenter. It's simple: How to use NSNotificationcenter

Community
  • 1
  • 1
Amandir
  • 679
  • 1
  • 7
  • 20
0

singleton is a good idea. You can also do it by using AppDelegate. If your data is not huge you can store your data in AppDelegate and access those from any viewcontroller.

Rashad
  • 11,057
  • 4
  • 45
  • 73
0

I have used delegate approach from 1. I wanted to pass data between third and second view controller so I just added this into third view controller viewDidLoad to catch if user goes to third tab after the tab bar starts in the first view controller

SecondViewController *svc = [self.tabBarController.viewControllers objectAtIndex:1];
self.delegate = svc;
vladicabg
  • 291
  • 3
  • 3