I have a TableViewController with x rows. When the user taps on one row , i want to pass to the second tableViewController a variable that will determine which data the second tableViewController should load. How would I do that?
I am using Xcode 4.2, storyboard
here’s the code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *__strong)indexPath
{
// Navigation logic may go here. Create and push another view controller.
TestTable *detail = [self.storyboard instantiateViewControllerWithIdentifier:@"TestTable"];
[self.navigationController pushViewController:detail animated: YES];
detail.num = [NSString stringWithFormat:[heads objectAtIndex:indexPath.row]];
In “heads” i get a number which i have to pass to the second tableview,depending upon which second tableview show data. Don’t know whether the last line loads “heads” in “num”. Is my approach correct?
Any help/reference is appreciated
1 Answer