views:

146

answers:

2

Hello!

Im a budding iphone developer, and doing my best but i have a query regarding the UINavigationController.

I have a tab bar app, with 3 tabs.

  • The 1st tab has five UIButtons, each loading a different "section" of the app, and each section will have a number of views.

  • The other tabs simply display some info.

  • as users select any of the UIButtons on my first tab i am using [self.view addSubview: xxxxx];

and as users navigate away from this view i use [self.view removeFromSuperview];

My question is:

Is this a bad way to do things? should i use a navigation controller? The reason i have not used one is because i wanted a custom looking UI and i understand that the navigation controller forces your design a little.

And on top of that i will be using core data to implement persistent storage.... will my way of implementing this application cause an issue with core data?

Any help regarding thsi would be highly appreciated.

Cheers

Tom

+2  A: 

First, if you don't need a navigation controller, then don't use it. You shouldn't feel bad about it. That said, I think UINavigationController doesn't impose a specific UI on you at all. It's very easy to hide the navigation bar and implement any UI you like. The thing that UINavigationController does impose is a modular design: each view is managed by a separate view controller and takes up the full screen. Only you can answer if this design is suitable for your app. If it is and if your app is designed around a hierarchy of views, a navigation controller is probably a good choice.

Ole Begemann
Thank you for your input, very helpful!
Tom G
+1  A: 

As you said: when one of the five buttons is tapped the users is navigating to another view and the five buttons disappear. This is what the navigation controller is designed for and helps you manage the memory better than simply adding and removing views (depending on how many views are added/removed it might also be better on performance). As Ole points out the NavigationController is highly customizable and doesn't impose much.

A NavigationController gives you more flexibility down the road: say you want to add another hierarchy level after one of the buttons has been tapped in version 2.0. Then you will find that your MainView will be growing as you keep adding views to it. A UINavigationController keeps your code well structured and lets you extend the navigation later one.

CoreData is very flexible and UI-independent. You shouldn't have to worry about this.

Felix
Thanks for the response this has helped me understand the need for a Navigation controller along with the implications on core data!
Tom G