Reputation: 39
I used two tableviewcontrollers
,i want to display country names array data in
first tableviewcontroller
(recipeBookTableViewController
) and other capital array data in second tableviewcontroller
(RecipetableviewController
),
when a first tableviewcontroller
cell is clicked it should move to second tableviewcontroller
with capital array data.
I have taken prepareforSegue
method to shift to second tableview
. but the method is never called.
how to send data to next tableview
.
RecipeBookViewController(table1) Recipetableview(table2)
INDIA (cell) ------------> Delhi(cell)
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"showRecipeDetail"])
{
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
RecipeDetailViewController *destViewController = segue.destinationViewController;
destViewController.second = [onew objectAtIndex:indexPath.row];
NSLog(@"%@",onew);
NSLog(@"data is %@",destViewController.second);
// destViewController.lable2 = [derivationArray objectAtIndex:indexPath.row];
// destViewController.image = [iconArray objectAtIndex:indexPath.row];
}
}
Upvotes: 0
Views: 79
Reputation: 4561
Problem is in creating segue.
Make sure you have created segue from cell of first table to second viewController.
Name the segue as showRecipeDetail
.
Look at the image below:
Upvotes: 2