我在将UITableViewController推送到NavigationController时遇到问题。使用以下代码:
ProblemEditController *problemEditController = [[[ProblemEditController alloc] initWithNibName:@"ProblemEditController" bundle:nil] retain];
problemEditController.problem = [[Problem alloc] init];
[self.navigationController pushViewController:problemEditController animated:YES];
[problemEditController release];
导航控制器按预期工作,但表格视图未显示。我的UITableViewController正在调用numberOfSectionsInTableView,但是没有调用numberOfRowsInSection和cellForRowAtIndexPath,并且视图显示为空白。
我有什么明显的遗失吗?
修改的
我在nib文件中更改了一些内容(愚蠢的,不记得是什么),我现在正在看到numberOfRowsInSection被调用。
答案 0 :(得分:1)
我基本搞砸了在IB中查看的连接。为了将来参考,这是自定义UITableViewController在IB中的样子:
alt text http://pix.im/files/134/scaled.jpg?1239453713
现在我觉得自己像个傻瓜。
答案 1 :(得分:0)
现在尝试使用** problemEditController *上的retain或release。
这段代码对我来说很好用:
formationsController = [[FormationsController alloc] initWithNibName:@"Formations" bundle:nil];
[navigationController pushViewController:formationsController animated:YES];