在我的应用程序中,我动态创建所有内容,并使用第一个选项卡创建TabBar
(TableView
)
我想在单元格中按下时导航并在didSelectRowAtIndexPath
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
TripDetailView * TripDetailViewObjec = [[TripDetailView alloc]initWithNibName:@"TripDetailView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:TripDetailViewObjec animated:YES];
}
self.navigationController=null
有什么帮助吗?
答案 0 :(得分:0)
导航不会发生,因为第一个Tab中没有navigationController
。要进行导航,您需要在TableViewController.try上嵌入导航控制器,以便在navigationController
内嵌入 - (void)applicationDidFinishLaunching:(UIApplication *)application {
UINavigationController * firstNavigationController = [[UINavigationController alloc]initWithRootViewController:yourTableViewController];
// temporarily just used one tab
//tabBarController should be already connected through NIB
[tabBarController setViewControllers:[NSArray arrayWithObjects:firstNavigationController,nil]];
self.window.rootViewController = tabBarController;
}
firstTab的TableView
{{1}}