我需要向父视图控制器发送数据;所以(在父母中)我创建了一个方法setLocWithName: loc:
来做到这一点。如何创建作为父控制器的对象?我试过parentViewController
了presentingViewController
(如下所示),但我收到了警告:
使用“UIViewController *”类型的表达式初始化“TDViewController *__strong”的不兼容指针类型
// set object of parent view controller
TDViewController *tDViewController = [[self navigationController] presentingViewController];
// get data
NSArray *locs = [[PLStore sharedStore] allLocs];
PL *setselectedLoc = [locs objectAtIndex:[indexpath row]];
// send data to parent view controller
[tDViewController setLocWithName:[setselectedLoc pLocName] loc:[setselectedLoc loc1]];
// Pop this view controller off the stack
[self.navigationController popViewControllerAnimated:YES];