I'm new with xcode ios programming i have 2 table view controllers and i want to pass object from child to parent controller. It is easy if pass from parent to child, but i can't find a simple way to pass object back from child to parent controller after a row in child view is selected.
Note: *searchFieldController is the parent controller
parent header file
@interface ProductSearchFieldTableViewController : UITableViewController <UITableViewDataSource, UITableViewDelegate>
@property(strong, nonatomic) NSString *selectedMake;
@end
parent implement file
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
// Configure the cell...
NSDictionary *field= [self.fields objectAtIndex:indexPath.row];
NSString *name=[field objectForKey:@"name"];
if([name isEqualToString: @"make"]){
[self performSegueWithIdentifier:@"valueSeque" sender:self];
}
}
Child implement file
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
ProductSearchFieldTableViewController *searchFieldController = [ProductSearchFieldTableViewController alloc];
searchFieldController.selectedMake =[[fields objectAtIndex:indexPath.row] objectForKey:@"value"];
[self.navigationController popViewControllerAnimated:YES];
}