views:

1294

answers:

2

I'm having a problem pushing a UITableViewController onto a NavigationController. With the following code:

ProblemEditController *problemEditController = [[[ProblemEditController alloc] initWithNibName:@"ProblemEditController" bundle:nil] retain];
problemEditController.problem = [[Problem alloc] init];
[self.navigationController pushViewController:problemEditController animated:YES];
[problemEditController release];

The navigation controller works as expected, however, the table view is not showing. numberOfSectionsInTableView is being called on my UITableViewController, but numberOfRowsInSection and cellForRowAtIndexPath aren't being called, and the view shows up blank.

Is there something obvious I am missing?

EDIT

I've changed something in the nib file (stupidly, can't remember what), and I'm seeing numberOfRowsInSection being called now.

A: 

Try now using retain or release on *problemEditController.

This piece of code works fine for me:

formationsController = [[FormationsController alloc] initWithNibName:@"Formations" bundle:nil];
[navigationController pushViewController:formationsController animated:YES];
Pablo Santa Cruz
Unfortunately this didn't work - same problem. I don't understand why the view isn't being shown when the numberOfSectionsInTableView function is called.
Mr. Matt
Try showing the view with prensetModalViewController instead of pushing it. To see if something changes.
Pablo Santa Cruz
Same thing - a blank view is displayed.
Mr. Matt
I've changed something in the nib file (stupidly, can't remember what), and I'm seeing numberOfRowsInSection being called now.
Mr. Matt
Thanks for your help, Pablo!
Mr. Matt
No prob! Good luck w/ your project.
Pablo Santa Cruz
A: 
Mr. Matt