Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.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
ios UITableView与自定义容器视图控制器一起崩溃_Ios - Fatal编程技术网

ios UITableView与自定义容器视图控制器一起崩溃

ios UITableView与自定义容器视图控制器一起崩溃,ios,Ios,在我的故事板中,我有两个视图,一个主视图和一个带有列表的详细视图。我想在master上显示详细视图。当我像这样向master添加细节时: - (void)viewDidLoad { [super viewDidLoad]; tableViewController = [[TableViewController alloc] init]; [self addChildViewController:detailVC]; [self.view addSubview:d

在我的故事板中,我有两个视图,一个主视图和一个带有列表的详细视图。我想在master上显示详细视图。当我像这样向master添加细节时:

- (void)viewDidLoad
{
    [super viewDidLoad];

    tableViewController = [[TableViewController alloc] init];
    [self addChildViewController:detailVC];
    [self.view addSubview:detailVC.view];
}
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
我会这样崩溃:

- (void)viewDidLoad
{
    [super viewDidLoad];

    tableViewController = [[TableViewController alloc] init];
    [self addChildViewController:detailVC];
    [self.view addSubview:detailVC.view];
}
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'

我确信我的table viewController一切正常,因为当我将其设置为rootViewController时,一切正常。我做错了什么?

似乎是tableview委托方法的问题。在故事板中,请为表视图控制器使用静态单元格,并删除表视图委托方法,或者实现所有必需的表视图委托方法

tableView cellForRowAtIndexPath出错。给我们该方法的代码,我们就能解决它。