views:

601

answers:

3

Hello experts!

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!

+3  A: 

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];
}
Rob Napier
A: 

Oh thank you for your answer. The

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

part was what i was looking for. Since I've specified the "RootView" Controller for my NavigationControllers View, self answers to navigationController.

Great! Thanks once again.

jakob
A: 

Hi there. thaks for your contributions. i had the same problem, added the UINavigationController via InterfaceBuilder though. my equivalent to [detailViewController release]; then causes my app to crash due to -[CALayer release]: message sent to deallocated instance

my guess is, that due to the fact i have my NavigationController all setup in the IB, the release isn't necessary.

do you know if my assumption is correct? (i know its a rather stupid question)

thx anyway

sam

samsam