Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdating DetailViewController from RootController
    primarykey
    data
    text
    <p>I'm trying to create an iPad application with a similar user interface to Apple's Mail application, i.e:</p> <ul> <li>RootView controller (table view) on the left hand side of the split view for navigation with a multiple view hierarchy. When a table cell is selected a new table view is pushed on the left hand side</li> <li>The new view on the left side can update the detail view.</li> </ul> <p>I can accomplish both tasks BUT NOT TOGETHER. I mean I can make a multi-level table view in the RootController.(<a href="http://www.megaupload.com/?d=XX2QRBU0" rel="nofollow">HERE you can find the working source code</a>).</p> <p>Or I can make a single-level table view in the RootController which can update the detailViewController (here there is the source code:http://www.megaupload.com/?d=D6L0463G).</p> <p>Can anyone tell me how to make a multi-level table in the RootController which can update a detailViewController?</p> <p>There is more source code at the link but below is the method in which I presume I have to declare a new detailViewController (which has to be put in the UISplitViewController):</p> <pre><code>- (void)tableView:(UITableView *)TableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row]; //Get the children of the present item. NSArray *Children = [dictionary objectForKey:@"Children"]; // if([Children count] == 0) { /* Create and configure a new detail view controller appropriate for the selection. */ NSUInteger row = indexPath.row; UIViewController &lt;SubstitutableDetailViewController&gt; *detailViewController = nil; if (row == 0) { FirstDetailViewController *newDetailViewController = [[FirstDetailViewController alloc]initWithNibName:@"FirstDetailView" bundle:nil]; detailViewController = newDetailViewController; } if (row == 1) { SecondDetailViewController *newDetailViewController = [[SecondDetailViewController alloc]initWithNibName:@"SecondDetailView" bundle:nil]; detailViewController = newDetailViewController; } // Update the split view controller's view controllers array. NSArray *viewControllers = [[NSArray alloc] initWithObjects:self.navigationController, detailViewController, nil]; splitViewController.viewControllers = viewControllers//nothing happens..... [viewControllers release];// } else { //Prepare to tableview. RootViewController *rvController = [[RootViewController alloc]initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]]; //Increment the Current View rvController.current_level += 1; //Set the title; rvController.current_title = [dictionary objectForKey:@"Title"]; //Push the new table view on the stack [self.navigationController pushViewController:rvController animated:YES]; rvController.tableDataSource = Children; [rvController.tableView reloadData]; //without this instrucion,items won't be loaded inside the second level of the table [rvController release]; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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