View Full Version : Menu on left of Split View with Submenus?

Jul 28, 2011, 12:17 PM
I'm about to start programming my first iPad app. However, I want to make sure my approach is sound before I begin.

I will be using a split view with navigation menus on the left and views on the right. My intent is to use a UINavigationController to handle the views on the right side based on the choices the user makes in the menu. I'm fairly sure I have this worked out code-wise and can handle it.

However, my menu on the left will not be one-dimensional. Most items will need to have the primary menu swap out to a second menu when the user chooses them. So I not only need to swap the view on the right, but also switch to the appropriate sub-menu that goes along with that view.

For example, when the user chooses Animals in the main menu, the main menu needs to change out and present them with another list of items, say Cats, Dogs, Rabbits. Had they chosen Food in the main menu, that menu would switch out and present them with the choices Pizza, Steak, Popcorn. Each item Cats, Dogs, Rabbits, Pizza, Steak, and Popcorn have unique views that will have to populate the detail view of the split view.

Does it make sense to also use a UINavigationController to handle the menus and swap the menus out programatically whenever the view is swapped? Can they track the pushing/pulling of the right-hand navigation controller's views?

I've searched the net for tutorials on this and can't seem to find any that use a multi-layer menu on the left of the split view (though I have found good ones that use single level menus). I'm surprised, because many apps I use have a multi-level menu. (Here is one tutorial I found for UINavigationControllers that seems very good assuming my menu had no sub-menus: http://www.matthewcasey.co.uk/2010/05/23/tutorial-introducing-uinavigationcontroller-part-1/)

(Note: I have quite a bit of C experience and did some Objective-C Mac OS X programming about 8 years ago, so I'm familiar with XCode. I just don't know how to handle this darned two-level menu I'm planning.)

Thanks for your help!

Jul 29, 2011, 02:42 AM
Hai, Well, good thinking though.
I think for your best need, is you need a Drill Down Table view.
So, if you click 1, it goes to 1-1, if you click 1-1, it goes to 1-1-1, if you click 2, it goes to 2-1 (each number representing a new tableview, getting pushed on the main navigation controller in the RootViewController typicly in a iPad app SplitViewController.
Once you click, you can set an ID to the Detailviewcontroller, and do stuff based upon that (mostly from an database or whatever).

What you could do, if you have only a couple of different sections, is make your rootviewcontroller just like it is, just add a TabbarSegment at the bottom, to switch between some sections, and already have the specific things in the tableview. And when you click that, you still have the NavigationContorller wise movement.

If you run into problems, report back here, and most of us can help you out.

Greetings, Noxx

Aug 2, 2011, 11:52 AM

Now that I know what I'm looking for, I'm finding tutorials all over the place.


Aug 2, 2011, 01:50 PM
So after giving my app some more thought, I’ve changed how I would like navigation to work a little bit. I think I can still use a drill-down table but with some modification. Let me explain how I want it to work (now) and my two thoughts on how to accomplish the change:

1. The “main screen” (top level) will be a UISplitView with the “main menu” in it. Once again, the first two menu items will be “Animals” and “Food”, however, there will also be an “All” category (perhaps actually the first item, but I’ll leave it in third place for this example).

2. On the “main screen” (top level, not having drilled down yet) the Detail view will be a list of all the animals and foods in the database (assuming "All" is selected in the menu on the left, or the app was just launched). This will be done in a slick UITableView on the detail side of the screen. Again, I’ll probably setup the Detail side of the split view as a navigation controller to make pushing/pulling detail views easier (which I'll need to do later on).

3. When “Animals” is tapped at the top level of the menu, the table on the right will only list animal data from the database. When “Food” is picked, it switches out the data source to only list foods.

4. Now, here’s the rub: When the user taps on a particular animal or food in the right hand detail-side table view, THAT’S when the menu on the left will drill down…to the particular type of data that was tapped. As well, the detail view will now show a detail of the particular record that was chosen. So if Animals is highlighted in the main menu and the user taps on the “Cat” record from the right-hand side table view, the menu will now drill-down to the “Animals” menu (which shows submenus “Description”, “Eating Habits”, “Habitat”, “Geneology”, etc….the next level down in the drill-down) and the right-hand detail view will now show the Description data view (probably using a Core Data form view) and will switch to separate Eating Habits, Habitat, and Geneology data views as the user chooses those items in the (now second level) menu on the left.

5. (There may also be other sublevels from there…)

I’m wondering how best to accomplish #4. Would it be better to:

A. Use a drill-down table view right from the get-go, but restrict switching to the submenu below if the user is currently at the top level…and force a switch out to the second level (first sublevel) once an item is picked on the right?

B. Or would it be better to use a separate table view at the top level then swap out for the drill-down coded one only once they’ve gone past the first level? And if that’s the case, I suppose I’ll have to customize a button to get my users back up to the top level from the first sublevel, right?

Thanks again everyone. I just don’t want to have to re-code the whole thing if I make a bad choice from the start…I figure once I’ve got the approach in hand, I can write some sample code and get the structure working.

I’m looking forward to your response(s).

Aug 4, 2011, 12:21 AM
Anyone have any suggestions on how I should proceed?

Aug 4, 2011, 03:03 AM
Your post is too long, and I don't have alot of time reading all of it, and thinking with you on it :)
Just try some stuff out, give it a go, and if you hit a wall, ask again, I will gladly answer your questions.
Just make a grouped tableview, which is a drill down, and learn the concepts etc. Then we shall see :)