I'm writing an app with 3 views - two hierarchical table views followed by a content page. The content in the final page is populated by the data stored in a variable that is determined by the row clicked in the second table view. As it stands, both tables populate with data fine, and the final page's content is populated fine as well, but every time acts as if the user clicked the first row, regardless of which row as actually pressed. This is the code for the segue from the second table view to the content view:
From my debugging so far, what I've realized is that self.tableView returns null. I assume what happens is that the view presumes the row is 0 and uses the data generated by the first row. I've got a global variable in this file called tableView, which is defined:
and
The weird part is that the segue from the first to second table view is managed with almost identical code, and it works just fine. Any thoughts? Thanks in advance.
Code:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"showUSViewDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSLog(@"%@", self.tableView);
USDetailViewController *destViewController = segue.destinationViewController;
NSString *currentSelection = [examDetailViewContents objectAtIndex:indexPath.row];
destViewController.usView = [views objectForKey:currentSelection];
}
}
From my debugging so far, what I've realized is that self.tableView returns null. I assume what happens is that the view presumes the row is 0 and uses the data generated by the first row. I've got a global variable in this file called tableView, which is defined:
Code:
@property (nonatomic, strong) IBOutletUITableView *tableView; // from the .h file
and
Code:
@synthesize tableView; // from the .m file
The weird part is that the segue from the first to second table view is managed with almost identical code, and it works just fine. Any thoughts? Thanks in advance.