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.
-
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];Mr. Matt : Unfortunately this didn't work - same problem. I don't understand why the view isn't being shown when the numberOfSectionsInTableView function is called.Pablo Santa Cruz : Try showing the view with prensetModalViewController instead of pushing it. To see if something changes.Mr. Matt : 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!Pablo Santa Cruz : No prob! Good luck w/ your project. -
OK, I've found out what I was doing wrong. I had added a TableViewController to my nib rather than just added a table view.
I'd basically messed up the connection to view in IB. For future reference, this is what a custom UITableViewController should look like in IB:
Now I feel like a cretin.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.