title: How to pass data back from multiple view controllers to root view controller using delegate? Ios 7
body: <p>My storyboard controllers: <a href="https://i.stack.imgur.com/4LBEd.png" rel="nofollow noreferrer">http://i.stack.imgur.com/4LBEd.png</a></p>
  
  <p>MenuViewController -> ChooseViewControler -> MapViewController and EditViewController.</p>
  
  <p>I need to pass variable called address from MapViewController or EditViewController to MenuViewController. How i can implement this?</p>
  
  <p>I try to use delegate, from this answer <a href="https://stackoverflow.com/questions/5210535/passing-data-between-view-controllers?answertab=votes#tab-top">Passing Data between View Controllers</a>
  but dont understand, how to tell MapViewController or EditViewController that MenuController is its delegate before we push its on nav stack.</p>
  
  <p>I do this at EditVC and its worked:</p>
  
  <pre><code>- (IBAction)OkButton:(id)sender {
  
      NSString *address = addressInput.text;
      MenuTableViewController *menuVC =
      [self.navigationController.viewControllers objectAtIndex:0];
      NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
      UITableViewCell *cell = [prevVC.tableView cellForRowAtIndexPath:indexPath];
      cell.textLabel.text = address;
  
      [self.navigationController popToViewController:menuVC animated:YES];
  
  }
  </code></pre>