0

I have a tabbed bar main window with four tabs, one of which is a list. This list is empty at first but when I click a "+" I am presented with a modal view of available options like this

- (IBAction)addThing:(id)sender {
    MJAvailableThingsViewController *controller = [self availableThingsViewController];
    [self presentModalViewController:availableThingsViewController animated:YES];
    [controller setEditing:YES animated:NO];
}

This works.

The list of things has a UITableViewCellAccessoryDetailDisclosureButton on each row. This was done with the accessoryTypeForRowWithIndexPath. This works as well.

When I click the little blue button in this view the delegate accessoryButtonTappedForRowWithIndexPath is called. This works.

However, in accessoryButtonTappedForRowWithIndexPath I want to present a detail view of the thing and this is where I encounter problems:

The delegate looks like this:

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath;
{
    NSLog(@"accessoryButtonTappedForRowWithIndexPath");
    NSLog(@"Tapped row %d", [indexPath row]);

    [[self navigationController] pushViewController:thingDetailViewController animated:YES];

The program enters this code but nothing happens, that is I get the NSLog output but no new window. I am very new at this so please forgive me if this is obvious; to me it is, however, not... :-)

  • How are you initializing thingDetailViewController – Dutchie432 Jul 07 '09 at 17:51
  • I tried overriding the getter thus: - (ThingDetailViewController *)thingDetailViewController { // Instantiate the add view controller if necessary. if (thingDetailViewController == nil) { thingDetailViewController = [ThingDetailViewController alloc]; } return thingDetailViewController; } –  Jul 08 '09 at 19:41
  • try: thingDetailViewController = [[ThingDetailViewController alloc] init]; – Dutchie432 Jul 15 '09 at 13:12

1 Answers1

0

Do you have a navigationController? It sounds like you have a TabController but not a NavigationController.

Check [self navigationController], is it set to anything?

Here's a similar question:
Tab Bar Application With Navigation Controller

Community
  • 1
  • 1
marcc
  • 12,295
  • 7
  • 49
  • 59
  • No, I don't have a navigationcontroller. The question you pointed me to is indeed very similar to my problem but I have not been able to use the advice therein, mainly due to inability. Bother. My latest attempt rendered me a view with just a table for availableThings, instead of the table with a title bar on top and the add button I used to have. –  Jul 08 '09 at 19:38