Question

I am a beginner to monotouch and created an app with a login screen that has links to Forgot Password page and Signup page as navigation controllers. The root view controller is navigation controller.

Now, after login the user is presented with a tabbed ui (4 tabs) with a tab bar controller. Each tab has it's own set of pages that i intend to navigate using the navigation controller.

What is the best way of implementing this? Should my root view controller be Nav. controller or tab bar controller? Since the nav controller as root works logically if it is a first time login scenario. But if the credentials of the user are saved, then i would directly open the tabbed interface when the app is opened. Appreciate the help

Was it helpful?

Solution

I would suggest to start with a navigation controller as root view controller, which has set the login screen as its only view controller for the case that your user isn't yet logged in. From that screen you are able to simply push your signup and forgotten password screens as well (within the base navigation controller, you don't have to set up new navigation controllers for each new screen, except you want to display it modaly (presenting instead of pushing it).

After the user logs in you simply switch the root view controller in AppDelegate to your tabbar controller which becomes the new root.

For each of the tabs shown within the tabbar you define a navigation controller which again contains the first screen you want to display at that specific tab item. So if you have 4 tabs, you set up 4 navigation controllers and pass them in UITabBarController.ViewControllers.

(I have currently chosen the exact same setup, so I am pretty sure that works :-)).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top