Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UITableViewController和NavigationController_Iphone_Cocoa Touch - Fatal编程技术网

Iphone UITableViewController和NavigationController

Iphone UITableViewController和NavigationController,iphone,cocoa-touch,Iphone,Cocoa Touch,将UITableViewController推送到NavigationController时遇到问题。使用以下代码: ProblemEditController *problemEditController = [[[ProblemEditController alloc] initWithNibName:@"ProblemEditController" bundle:nil] retain]; problemEditController.problem = [[Problem alloc] i

将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没有被调用,并且视图显示为空白

我有什么明显的遗漏吗

编辑


我已经更改了nib文件中的某些内容(愚蠢的,不记得是什么),现在正在调用numberOfRowsInSection。

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

这段代码对我来说很好:

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

好吧,我已经发现我做错了什么。我在nib中添加了一个TableViewController,而不仅仅是添加了一个表视图

我基本上弄乱了IB中与view的连接。为了将来参考,这是IB中自定义UITableViewController的外观:


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

不幸的是,这不起作用——同样的问题。我不明白调用numberOfSectionsInTableView函数时为什么不显示视图。请尝试使用prensetModalViewController显示视图,而不是按它。查看是否有更改。同样的事情-显示一个空白视图。我已经更改了nib文件中的某些内容(愚蠢的,不记得是什么),现在我看到numberOfRowsInSection正在调用。没问题!祝你的项目好运。有时候,我觉得Interface Builder是一个障碍,因为iOS库中的所有高级示例项目都是通过编程方式创建它们的许多控制器的,因此有时很难确定nib文件在整个应用程序生命周期中的位置。