Note that there are some explanatory texts on larger screens.

plurals
  1. POindexPath null in didSelectRowAtIndexPath in an ipad splitview navigation app
    primarykey
    data
    text
    <p>I'm porting a fairly simple iPhone Navigation based app to a Split View iPad app.<br> I have two nested levels of navigation on the Master view. The user picks a value from the first table and it loads the 2nd table. Selecting a value on the second table loads the Detail item for the detail view. Or it's supposed to. The didSelectRowAtIndexPath on my 2nd controller is firing but indexPath is null. </p> <p>I'm following the SplitView template fairly closely. I'm only really getting off the beaten track by adding that 2nd TableViewController. My RootViewController loads the 2nd TableViewController on didSelectRowAtIndexPath, and that part's working. In my 2nd TableViewController.m I'm trying to set the detail item for the DetailView. But it's that didSelectRowAtIndexPath method that's not giving me the row. I'm fairly new to this, but it seems odd to me that the method for clicking a row would fire but not have the index for that row. </p> <p>Here's the code:</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { TrackerSplitViewAppDelegate *appDelegate = (TrackerSplitViewAppDelegate *)[[UIApplication sharedApplication] delegate]; detailViewController.thisRequest = [appDelegate.requests objectAtIndex:indexPath.row]; NSLog(@"Request Loaded: %@", detailViewController.thisRequest.Title); NSLog(@"Index Row: %@", indexPath.row); [appDelegate release]; } </code></pre> <p>The array of requests is loading properly (appDelegate.requests) but my objectAtIndex is failing because indexPath is null. Or at least indexPath.row is null. </p> <p>EDIT: Ok, the comments below are correct, I'm not using NSLog properly. The indexPath.row is fine (I thought it was also showing up as null using the mouseover in the debugger, but I just don't know how to use the debugger properly).</p> <p>The detailViewController property isn't getting set right for some reason. If I substitute with this:</p> <pre><code>//detailViewController.thisRequest = [appDelegate.requests objectAtIndex:indexPath.row]; Request *aRequest = [appDelegate.requests objectAtIndex:indexPath.row]; </code></pre> <p>The aRequest object loads just fine. So the next question is why setting my property on my detailViewController object isn't working. I'm still quite fuzzy on how things persist in this environment. Any additional input would be great. </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. This table or related slice is empty.
    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