选择单元格时,表视图不加载nib

时间:2010-08-24 19:38:01

标签: iphone

我有以下代码

 if ([[tableView cellForRowAtIndexPath: indexPath].textLabel.text isEqualToString: @"added"]) {
    NSLog (@"hello");
    FinalViewController *anotherViewController = [[FinalViewController alloc] initWithNibName:@"FinalViewController" bundle:nil];
    NSLog (@"hello2");

    [self.navigationController pushViewController:anotherViewController animated:YES];
    [anotherViewController release];
    NSLog (@"hello3");

并且在用户点击时绝对没有任何作用。在测试时,所有日志都会出现,因此我不确定问题所在。

2 个答案:

答案 0 :(得分:1)

self.navigationController可能是零。表视图控制器是如何添加到导航控制器的?

答案 1 :(得分:0)

您是否检查过是否在顶部导入了头文件? 你为什么不尝试使用bundle:[NSBundle mainBundle]?