Iphone 选项卡栏应用程序上的TableView?应用程序正在崩溃

Iphone 选项卡栏应用程序上的TableView?应用程序正在崩溃,iphone,tableview,tabbar,Iphone,Tableview,Tabbar,复制步骤: 1.创建名为TestApp的选项卡栏应用程序 2.添加新文件,这是一个UIViewController子类,具有名为Table的XIB用户界面 3.打开MainWindows.xib,单击第二个选项卡栏项,然后在Inspector中将NIB名称从SecondView更改为Table。保存并关闭。 4.打开Table.xib并在视图顶部拖动一个TableView。现在将TableView的数据源和代理出口链接到Table.xib文件的所有者。 5.将以下代码添加到表.m中: - (NS

复制步骤: 1.创建名为TestApp的选项卡栏应用程序 2.添加新文件,这是一个UIViewController子类,具有名为Table的XIB用户界面 3.打开MainWindows.xib,单击第二个选项卡栏项,然后在Inspector中将NIB名称从SecondView更改为Table。保存并关闭。 4.打开Table.xib并在视图顶部拖动一个TableView。现在将TableView的数据源和代理出口链接到Table.xib文件的所有者。 5.将以下代码添加到表.m中:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
NSLog(@"Returning num sections");
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(@"Returning num rows");
return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Trying to return cell");

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
cell.text = @"Hello";
NSLog(@"Returning cell");
return cell;
}
6.运行应用程序并选择第二个选项卡栏项目

如果我从一个基于视图的应用程序开始,向它添加一个TableView,将outlets链接到文件的所有者,然后添加那段代码,一切都很好。
我做错了什么?为什么应用程序会崩溃?

在Interface Builder中,将NIB名称更新为表后,单击inspector的标识选项卡(最后一个选项卡)。然后将类标识更新为“表”