3

I am having some issues on UI design.

Alternative 1:

  • UINavigationController
    • TabBarController
      • MapViewController
      • UINavigationContoller
        • UITableViewController
          • DetailViewController

Alternative 2:

  • UINavigationController
    • TabBarController
      • MapViewController
      • UITableViewController
        • DetailViewController

In alternative 1 in the navigationitem of DetailViewController the backButton and the title are not being shown but I have the lower tabbar.

In alternative 2 in the navigationitem of DetailViewController the backButton and the title are visible but I am missing the lower tabbar.

Is there any way to have both features of alternative 1 & 2?

I need the the top most Navigation Controller because in the TabBarViewController I have a LeftBarButtonItem showing a side menu (SWRevealViewController).

EDIT

Code in TableViewController

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    poiDetail = [poiManager.listOfPois objectAtIndex:indexPath.row]; // does not work with regions-sections
    [self performSegueWithIdentifier:@"poiDetail" sender:self];
}

where "poiDetail" segue is a push e.g. 'Show' segue.

Sanandrea
  • 2,112
  • 1
  • 27
  • 45
  • Alternative 1 should work. I am not sure how you're coding it. Can you please share some codr here. – Jassi Mar 25 '15 at 16:07
  • Code of which ViewController – Sanandrea Mar 25 '15 at 16:08
  • From did select in table view controller, whn pushing to detail – Jassi Mar 25 '15 at 16:14
  • Adding `tabBarController` inside `navigationController` is not a good idea. reference: http://stackoverflow.com/questions/576764/tab-bar-controller-inside-a-navigation-controller-or-sharing-a-navigation-root – Pushparaj Mar 31 '15 at 08:11
  • You can add navigationController to all tab of tabBarController and then you can add (SWRevealViewController) for side menu to all navigation controller. (Main problem is that most of the library for side menu doesn't provide support for tabBarController) – Pushparaj Mar 31 '15 at 08:16

2 Answers2

1

Yes I implemented same scenario and facing the same issue, Fortunately I am able to solve this in my application,

I am suggesting Alternative 1

You can set Initial UINavigationController in AppDelegate and maintain application flow with same navigation controller till nested UINavigationController. And set TabBar controller as a RootViewController

In RootViewController of nested NavigationController please hide AppDelegate navigationController's NavigationBar. So you are able to resolved issue of Alternative 1 that you are facing.

I referred this library: https://github.com/juliorimo/CustomTabBar-iOS (Note: This library is just one UINavigationController and TabbarController further Nested UINavigationController flow you have to maintain)

Ajay Gabani
  • 1,168
  • 22
  • 38
  • how can I hide the NavigationBar of the root UINavigationController? – Sanandrea Apr 02 '15 at 14:03
  • appDelegate.navigationController.navigationBar.hidden = true; => By adding this line in to NestedNavigationController's RootViewController – Ajay Gabani Apr 03 '15 at 03:49
  • yes, it worked thank you. I don't need to save a reference in AppDelegate because I am using SWRevealViewController, and all UIViewControllers have a pointer to it. I should show it again when the detail view pops from navigation stack. Thank you! – Sanandrea Apr 03 '15 at 11:28
-2

Hey I propose Alternative 3:

  • UINavigationController
    • Tab Bar Controller
      • Nav Controller
        • Map View Controller
      • Nav Controller
        • Table View Controller
          • Detail View Controller

You essentially want the two View Controller managed by the Tab Bar Controller to be wrapped in Nav Controllers

  • what does this change in mapviewcontroller wrapping has to do with detailviewcontroller that is in another branch? – Sanandrea Mar 25 '15 at 16:11
  • 1
    Its a cleaner and more organized way of setting up your app. It also may solve your issue of no navigationitem in your Detail View Controller. Is the back button present in your Table View Controller and are you pushing to the detail view controller like `[self.navigationController pushViewController:detailViewController animated:YES];` – Lee J Pollard Mar 25 '15 at 16:15