title: ios Pass data between navigation controller
body: <p>I'm having a bit of a problem with my app, I have these view controllers below:</p>
  
  <p><img src="https://i.stack.imgur.com/lQB7i.png" alt="enter image description here"></p>
  
  <p>I have the locations view controller with an array of locations and I have a locations array in the Menu Table view controller, I need to pass the array from Locations to Menu Table, but I dont know how, can somebody Help me? I have tried this coding below:</p>
  
  <pre><code>-(void)pushMenuTableView
  {
  
  UIStoryboard *storyboard = self.storyboard;
  UINavigationController *menuTableController = (UINavigationController *)[storyboard instantiateViewControllerWithIdentifier:@"MenuTableViewController"];
  
  MenuTableViewController *menuController = (MenuTableViewController *) menuTableController.topViewController;
  
  [self.navigationController pushViewController:menuTableController animated:YES];
  
  }
  
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
  MenuTableViewController *mvc = [[MenuTableViewController alloc]init];
  NSIndexPath *path = [self.tableView indexPathForSelectedRow];
  Location *selectedLocation = [_locations objectAtIndex:[path row]];
  [mvc setLocation:selectedLocation];
  [self pushMenuTableView];
  
  }
  </code></pre>