1
votes

I recently found a good tutorial about how to place a navigation controller within a tabbarcontroller("The nib way").

http://twilloapp.blogspot.com/2009/05/how-to-embed-navigation-controller.html

I continued with the second step and added a tableviewcontroller to the navcontroller.

What I don't understand, is how I can use the navigationbarcontroller from within my tableviewcontroller and e.g - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

What I want to do is when a user selects a row another view should slide in with the back button and everything that a navigationcontroller provides.

Thanks in advance!

2

2 Answers

3
votes

Have you started with Apple's SimpleDrillDown sample? The specific code in question is this routine:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    /*
     Create the detail view controller and set its inspected item to the currently-selected item
     */
    DetailViewController *detailViewController = [[DetailViewController alloc] initWithStyle:UITableViewStyleGrouped];

    detailViewController.detailItem = [dataController objectInListAtIndex:indexPath.row];

    // Push the detail view controller
    [[self navigationController] pushViewController:detailViewController animated:YES];
    [detailViewController release];
}
0
votes

The following was what I was looking for:

[[self navigationController] pushViewController:detailViewController animated:YES];
[detailViewController release];

Since I've specified the RootView Controller for my NavigationControllers View, self answers to navigationController.