没有显示从桌视图的详细的看法

时间:2011-07-10 01:20:21

标签: iphone xcode cocoa-touch

我是编程的新手,我有一个基于视图的应用程序,它从SQLite数据库收集数据并在表格中显示。我已经开始工作,但是一旦桌面上的项目被选中,我就无法让应用程序显示详细视图。如果有人可以提供帮助,这是我的代码。

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

    if (dvController == nil)
        dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle: nil];

    Clubs *clubObj = [appDelegate.clubArray objectAtIndex:indexPath.row];

    [clubObj hydrateDetailViewData];

    dvController.clubObj = clubObj;

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

}

-(void)viewDidLoad {
[super viewDidLoad];

appDelegate = (ClubFindAppDelegate *) [[UIApplication sharedApplication] delegate];
self.title = @"Back";

}

任何帮助都会受到谴责。 感谢

1 个答案:

答案 0 :(得分:1)

如果您开始使用基于视图的应用,可能您的视图控制器没有可用的self.navigationController实例。您的视图控制器必须位于导航控制器堆栈中才能推送更多视图控制器。

要将基于视图的应用程序转换为带导航控制器的应用程序,您真正需要做的就是编辑应用程序委托,如下所示:

// view based app template code
self.window.rootViewController = self.viewController;

变为

UINavigationController * controller = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.window.rootViewController = controller;

您可能还希望将navigationController另存为应用程序委托的属性。

相关问题