0

I'm at a point in the development of the app I'm working on where in order to complete the assignments given to me, it seems like the best way to accomplish what I need is to combine a UINavigationController with a UITabBarController.

Structurally, the app has a home page, and the rest of the app is navigated through the UITabBarController. This is a sound design for the original, but when I took over the development process of this, I had to make a lot of additions to the app, and there's technically supposed to be a "second" section which adds extra "features" if you will that aren't necessarily related to the main functionality of the app itself.

Basically, since everything begins at the Overview, the user is supposed to have a choice between just diving into the app itself, or using some of these extra features. I'm thinking the Navigation Controller would be fitting for the extra features, but I'm not sure how I can add to it.

What I need to know is - is this solution to the problem sound? If so, what's a good way to accomplish this? Is it ok to have a separate UIWindow class to link the Navigation Controller up with the TabBar Controller?

Granted, this app has used a lot of nib files, and every time I've tried to do something programmatically, it just hasn't worked. Thus, if someone could point out a NIB method of achieving this, I'd appreciate it.

zeboidlund
  • 9,731
  • 31
  • 118
  • 180

1 Answers1

2

According to Apple recommendation, UITabBarController should always be the root view controller of your app. So basically your main view is just one tab of your tab view controller, and so you just need to embed your main view controller in a navigation controller. This way you can navigate to whatever page you wish within that tab using the navigation controller, or you can go to other tabs using the tabbar controller.

danqing
  • 3,348
  • 2
  • 27
  • 43
  • Do you think you could be a little more detailed? I've been trying to embed my Main View into the controller, but it won't display. – zeboidlund Aug 02 '12 at 17:54
  • You mean adding a view controller to `UITabBarController`? You just do something like `[tabBarController setViewControllers: [NSArray arrayWithObjects:1Controller, 2Controller, 3ViewController, nil]];`. But Storyboard will be much easier if you can use it. – danqing Aug 02 '12 at 18:21
  • Unfortunately I can't use a Storyboard - it would take too long to port the legacy code from iOS 4.x to that. Just to clarify: since `UITabBarController` is my root (and should be, regardless), you're suggesting I add a navigation controller to my appDelegate, and then add my MainView to that? – zeboidlund Aug 02 '12 at 21:00
  • I think your MainView should be the root controller of your `UINavigationController`, which should be just one tab in the `UITabBarController`. – danqing Aug 02 '12 at 21:02
  • Care to discuss this in chat? http://chat.stackoverflow.com/rooms/info/14823/discussion?tab=general – zeboidlund Aug 02 '12 at 21:09