-1

我有我的第一个普通视图控制器,其中包含一个UITableView。需要在这些行中显示的项目完美地工作。

现在问题来了,如果用户选择一行,我想打开一个新视图。这种观点称为SecondViewController。所以我有以这种方式命名的.h,.m.xib文件,它属于UIViewController类。

我正在使用CustomCelltableview 这可能是问题吗?

#imported一切正常,这是我在方法中使用的代码:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];

    [self.navigationController pushViewController:secondViewController animated:YES];

}

我到底做错了什么?我已经在这里看了几个小时的问题,但似乎没有任何效果。

4

1 回答 1

0

你确定 self.navigationController 不为零吗?

尝试记录它,从您的代码中,您的问题可能是,您的 self.navigationController 为零。

这个类是从另一个类推过来的,还是你在这个类中开始导航?如果您在此类中启动它,这是您的问题,您需要调用您创建的导航,而不是应该与您的视图控制器一起使用的导航。

于 2013-06-05T17:35:20.607 回答