我正在构建一个代表具有 UINavigationController (navigationController) 的应用程序。第一个视图是一个 UITabViewController (tabView),它有一个 UINavigationController 和一个 UIViewController 和一个显示一些联系人的 UITableView。
我想要做的是在点击表格视图中的联系人(在最顶部的导航控制器上)时推送一个带有联系人信息的新视图控制器
我在 appDelegate 中执行以下操作:
[self.window makeKeyAndVisible];
[self.window addSubview:[navigationController view]];
TabsView *tabsView = [[TabsView alloc] initWithNibName:nil bundle:nil];
[navigationController.view addSubview:[tabsView view]];
tabsView 的第一个选项卡加载 ContactsView.m,它有一个包含所有联系人的 UINavigationController,当有人点击一行时,它应该像这样推送新视图:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[table deselectRowAtIndexPath:indexPath animated:YES];
ContactSecondView * varContactSecondView = [[ContactSecondView alloc] initWithNibName:nil bundle:nil];
varContactSecondView.title = [[contactsArray objectAtIndex:indexPath.row] name];
[self.navigationController pushViewController:varContactSecondView animated:YES];
[varContactMapView release];
}
但是连续触摸时没有任何反应。
所以我有不同的文件:使用 UINavigationController <- UITabViewController <- UIViewController 和 UINavigationController 和 UITableView 进行委托;我想将 ViewController 推入第一个导航控制器。
应该如何访问委托的 navigationController?我做对了吗?
编辑:如果这提供了任何线索,当我self.navigationController.title = @"Contacts";
在 ContactsView.m 中这样做时,它不会更改顶栏的标题。
谢谢!