2009-04-11 59 views
0

我在将UITableViewController推送到NavigationController时出现问题。使用以下代码:UITableViewController和NavigationController

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

导航控制器按预期工作,但未显示表格视图。 numberOfSectionsInTableView在我的UITableViewController上被调用,但是numberOfRowsInSection和cellForRowAtIndexPath没有被调用,并且视图显示为空白。

有什么明显的我失踪了吗?

编辑

我在笔尖文件(愣神,不记得是什么)改变了一些东西,我看到现在numberOfRowsInSection被调用。

回答

1

好了,我发现我在做什么错。我已经添加了一个TableViewController到我的笔尖,而不是只添加一个表视图。

我基本上搞砸了连接在IB查看。对于未来的参考,这是一个自定义的UITableViewController应该是什么样子的IB:

alt text http://pix.im/files/134/scaled.jpg?1239453713

现在我觉得自己像个白痴。

0

现在尝试在** problemEditController *上使用retain或release。

这段代码工作正常,我:

formationsController = [[FormationsController alloc] initWithNibName:@"Formations" bundle:nil]; 
[navigationController pushViewController:formationsController animated:YES]; 
+0

不幸的是,这没有奏效 - 同样的问题。我不明白为什么在调用numberOfSectionsInTableView函数时没有显示视图。 – Codebeef 2009-04-11 12:07:26

+0

尝试使用prensetModalViewController而不是推送视图来显示视图。看看是否有变化。 – 2009-04-11 12:16:29

相关问题