Ios IPhone SDK在表视图中添加了一个表视图

Ios IPhone SDK在表视图中添加了一个表视图,ios,iphone,uitableview,Ios,Iphone,Uitableview,我想在表视图中创建一个表视图。我的意思是,我如何制作一个应用程序,使单击一个单元格可以转到另一个单元格列表以单击转到子类?我不知道表视图中的表视图是什么意思,我想你要做的是有一个表视图的层次结构。您可以将另一个表视图推送到委托方法didselectrowatinexpath内的堆栈上 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { MySecondV

我想在表视图中创建一个表视图。我的意思是,我如何制作一个应用程序,使单击一个单元格可以转到另一个单元格列表以单击转到子类?

我不知道表视图中的表视图是什么意思,我想你要做的是有一个表视图的层次结构。您可以将另一个表视图推送到委托方法
didselectrowatinexpath
内的堆栈上

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    MySecondViewController *secondController = [[MySecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    [self.navigationController pushViewController:secondController animated:YES];
}

通过在单击单元格时实现此方法,它将转到另一个表视图(单元格列表)。

卷积的答案包含内存泄漏。正确的代码应该如下所示:

MySecondViewController *secondController = [[MySecondViewController alloc]
    initWithNibName: @"SecondViewController" bundle: nil];
if (secondController != nil) {
    [self.navigationController pushViewController: secondController animated: YES];
    [secondController release];
}

版本
至关重要。否则你会泄漏内存。

谢谢,我希望他知道释放对象的事,但现在这是完美的复制粘贴代码。