【发布时间】:2011-10-26 15:25:31
【问题描述】:
我正在构建一个应用程序,它的委托具有 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
应该如何访问委托的navigationController?我做得对吗?
编辑:如果这提供了任何线索,当我在 ContactsView.m 中执行 self.navigationController.title = @"Contacts"; 时,它不会更改顶部栏的标题。
谢谢!
【问题讨论】:
标签: ios uinavigationcontroller pushviewcontroller uitabview