My storyboard controllers: https://i.stack.imgur.com/4LBEd.png
MenuViewController -> ChooseViewControler -> MapViewController and EditViewController.
I need to pass variable called address from MapViewController or EditViewController to MenuViewController. How i can implement this?
I try to use delegate, from this answer Passing Data between View Controllers but dont understand, how to tell MapViewController or EditViewController that MenuController is its delegate before we push its on nav stack.
I do this at EditVC and its worked:
- (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];
}