I have an unwind segue that i am using, and then i have a prepare for segue that i am using to push data. I need the unwind segue to push the data but i am having issues combining them. Here is the unwind segue code -
- (IBAction)unwindFromDetailViewController:(UIStoryboardSegue *)segue {
// ViewController *detailViewController = [segue sourceViewController];
NSLog(@"%@", segue.identifier);
}
And here is the prepare for segue code -
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"showRecipeDetail"]) {
NSIndexPath *indexPath = nil;
Recipe *recipe = nil;
if (self.searchDisplayController.active) {
indexPath = [self.searchDisplayController.searchResultsTableView indexPathForSelectedRow];
recipe = [searchResults objectAtIndex:indexPath.row];
} else {
indexPath = [self.tableView indexPathForSelectedRow];
recipe = [recipes objectAtIndex:indexPath.row];
}
PersonDetailTVC *destViewController = segue.destinationViewController;
destViewController.recipe = recipe;
[self dismissViewControllerAnimated:YES completion:nil];
}
}
And here is what i tried which is unwinding the segue, but not pushing the data.
- (IBAction)unwindFromDetailViewController:(UIStoryboardSegue *)segue {
if ([segue.identifier isEqualToString:@"CustomTableCell"]) {
NSIndexPath *indexPath = nil;
Recipe *recipe = nil;
if (self.searchDisplayController.active) {
indexPath = [self.searchDisplayController.searchResultsTableView indexPathForSelectedRow];
recipe = [searchResults objectAtIndex:indexPath.row];
} else {
indexPath = [self.tableView indexPathForSelectedRow];
recipe = [recipes objectAtIndex:indexPath.row];
}
PersonDetailTVC *destViewController = segue.destinationViewController;
destViewController.recipe = recipe;
[self dismissViewControllerAnimated:YES completion:nil];
}
}