简体   繁体   English

具有多个视图的iOS表格视图导航控制器

[英]iOS table view navigation controller with multiple views

I have an iOS 7 application that has a Tab Bar controller. 我有一个带有Tab Bar控制器的iOS 7应用程序。 On one tab I have a tableView, from which I can select a cell, and navigate to a detail view. 在一个选项卡上,我有一个tableView,可以从中选择一个单元格,然后导航到详细视图。

On the detail view I had the following to be able to navigate to another view: 在详细信息视图上,我具有以下才能导航到另一个视图:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"Table View Cell Clicked on row: %ld", indexPath.row + 1);

    ThirdViewController *view = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:[NSBundle  mainBundle]];
    modelView.managedObjectContext = self.managedObjectContext;
    [self.navigationController pushViewController:view animated:YES];
}

But this does not let me navigate to the new View. 但这不能让我导航到新的视图。 How can I navigate to multiple view, I require this: 我如何导航到多个视图,我需要这样做:

View1 -> View2 -> View3 -> View4 -> View5 -> View6 - All these view contain a table view, and the selection to another view is by selecting on row on the table. View1-> View2-> View3-> View4-> View5-> View6-所有这些视图都包含一个表视图,并且通过在表的行上进行选择来选择另一个视图。

Thanks Best Regards 最好的问候

UPDATED: Problem solved. 更新:问题已解决。 the last table view did to add the delegate outlet set. 最后一个表视图确实添加了代理出口集。 That wa the problem. 那就是问题所在。 Thanks 谢谢

Check if self.navigationController is nil. 检查self.navigationController是否为nil。 If it is, it means you need to add navigation controller to the tab view controller: 如果是,则意味着您需要将导航控制器添加到选项卡视图控制器:

[tabViewControllers addObject:[[UINavigationController alloc] initWithRootViewController:myTableViewController]]; 
tabBarController.viewControllers = tabViewControllers;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM