【发布时间】:2014-07-15 08:56:47
【问题描述】:
我的故事板控制器:http://i.stack.imgur.com/4LBEd.png
MenuViewController -> ChooseViewControler -> MapViewController 和 EditViewController。
我需要将名为地址的变量从 MapViewController 或 EditViewController 传递给 MenuViewController。我该如何实现?
我尝试使用委托,来自这个答案Passing Data between View Controllers 但不明白,在我们将其推送到导航堆栈之前,如何告诉 MapViewController 或 EditViewController MenuController 是它的委托。
我在 EditVC 做这件事,而且效果很好:
- (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];
}
【问题讨论】:
标签: ios objective-c ios7 delegates xcode5