To get a link to your UINavigationController in your case, you must do the following and first specify the correct tabBarController index:
UINavigationController *nav = [self.tabBarController.viewControllers objectAtIndex:<THE_INDEX_NUMBER_FOR_YOUR_NAVIGATION_CONTROLLER];
Once you do this, you will get a link to your FoodViewController , again indicating the index number for it on the UINavigationController (i.e. if it is on top, and then 0 ):
FoodViewController *destViewController = (FoodViewController*) [self.nav.viewControllers objectAtIndex:0];
Update
Now that I understand what you would like to achieve:
You are using the UITabbarController into which your other controllers are embedded.
Script / example example :
Let's say we had 2 view controllers, controller A and controller B, respectively, both built into the UITabbarController .
What do we want:
We are trying to change the text a UILabel in controller B from controller A.
First declare property in controller B in .h:
@property(strong, nonatomic) UILabel *aLabelInControllerB;
Second, declare a property (or ivar) in your controller A:
@property(strong, nonatomic) ControllerB *controllerB;
Since you are using a UITabbarController , you do not need to use segue, you can just get the UITabbarController through self.tabBarController ;
Question : "How do I know when my tab bar controller will listen, and then change the label text in controller B?"
We doing this:
Set Controller A as a UITabbarController delegate by:
In the controller Ah add:
@interface <Your_Controller> : UIViewController <UITabBarControllerDelegate>
In viewDidLoad controller A:
self.tabBarController.delegate = self;
And in the Am controller, we implement this method:
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { self.controllerB = (ControllerB *) [tabBarController.viewControllers objectAtIndex:1];
And as controller B appears, you will see that the label text will be changed to "Hello!"
Installing a NSString in controller B follows the same procedure.
Example: self.controllerB.stringInControllerB = @"Hi from controller B!";
Hope this helps.
Update 2:
Go from table cell to tab bar controller? Okie .. Here is the solution. I use only one cell in my example, so if you want to have more cells in the future, I would leave it to you to set up.
Let's look at the layout:

In the control storyboard, drag a tab bar from your cell to the controller.
Add a UINavigationController as in the picture.
In UITableViewController .m:
Add 2 properties:
@property (strong, nonatomic) UITabBarController *myTabbarController; @property (strong, nonatomic) YourFirstViewController *myFirstViewController;
Just a friendly reminder:
Do not forget to add:
self.tableView.delegate = self; self.tableView.dataSource = self;
Add the following to the table view controller:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { self.myTabbarController = (UITabBarController*) [segue destinationViewController]; self.myFirstViewController = [self.myTabbarController.viewControllers objectAtIndex:0]; self.myFirstViewController.stringFromTableViewController = @"Hi from TableViewController!"; }
And in myFirstViewController add 2 properties to .h:
@property (strong, nonatomic) NSString *stringFromTableViewController; @property (strong, nonatomic) YourSecondViewController *secondViewController;
As in the second of the above changes, your first view controller must still be a UITabBarControllerDelegate delegate and implement this method:
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { self.secondViewController = (YourSecondViewController*) viewController; self.secondViewController.aLabel.text = self.stringFromTableViewController; }
As before, nothing needs to be changed in the SecondViewController .
I ran myself; It should be good to get to the setting.
Enjoy.