Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, please try this in ProductViewController:</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; NSLog(@"Row clicked: %i", indexPath.row); Product *product = (Product *) [_products objectAtIndex:indexPath.row]; NSLog(@"Product: %@", product); TabAndSplitAppAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; NSLog(@"appDelegate: %@", appDelegate); UITabBarController *tbc = appDelegate.tabBarController; NSLog(@"tbc: %@", tbc); MySplitViewController *msvc = tbc.selectedViewController; NSLog(@"msvc: %@", msvc); UINavigationController *rnc = msvc.rightController; NSLog(@"rnc: %@", rnc); DetailedVC *dvc = rnc.topViewController; NSLog(@"dvc: %@", dvc); dvc.detailDescriptionLabel.text = @"We found our DetailedVC"; [dvc productSelectionChanged:product]; } </code></pre> <p>This code is not an example of how you should structure your program properly. This was just to help me (and you) understand your view controller hierarchy.</p> <p>The initial idea of notifying a delegate when a product is selected is spot on, it just didn't work in your case because the objects weren't wired up properly. You should try to do that though. In the code you posted, I don't see a location where both the <code>ProductViewController</code>and the <code>DetailedVC</code> are both directly visible so that you could just say</p> <pre><code>productViewControllerInstance.delegate = detailedVCinstance; </code></pre> <p>The nearest to that is in AppDelegate where you have the <code>RootVC</code> instance <code>rvc</code>that presumably eventually will create the <code>ProductViewController</code> and the <code>dvc</code>. Maybe you could give the <code>dvc</code>to the <code>rvc</code>so that it can set it as the <code>ProductViewController</code>'s delegate when it's created. Good luck!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload