I'm developing an iOS app which asks the user to either login or signup before using the functionality. The flow is; The app displays a screen with 2 buttons 1) Login 2) Signup Upon clicking either button the app navigates the user to different view controllers using UiNavigationController. Upon successful login the user is directed towards a home view controller which displays a tab bar on the bottom of the view and a UiNavigationController's top bar on the top of the view.
To implement this, I have set the UINavigationViewController as the root view controller in the AppDelegate file.
As soon as the user is authenticated, I push the tab bar controller on the UiNavigationController using the following code.
FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
[firstViewController setTabBarItem:[[UITabBarItem alloc] initWithTitle:@"1st" image:[UIImage imageNamed:@"1st.png"] tag:101]];
SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[secondViewController setTabBarItem:[[UITabBarItem alloc] initWithTitle:@"2nd" image:[UIImage imageNamed:@"2nd.png"] tag:102]];
ThirdViewController *thirdViewController = [[ThirdViewController alloc]initWithNibName:@"ThirdViewController" bundle:nil];
[thirdViewController setTabBarItem:[[UITabBarItem alloc] initWithTitle:@"3rd" image:[UIImage imageNamed:@"3rd.png"] tag:104]];
UITabBarController *tabController = [[UITabBarController alloc] init];
[tabController setViewControllers:[NSArray arrayWithObjects:firstViewController, secondViewController,thirdViewController, nil]];
[self.navigationController pushViewController:tabController animated:YES];
Is this the right approach? Someone just said that the using tab bar controller as root view controller will be a better approach. How can I just set the tab bar controller as root view controller as I dont want to show the tab bar on login/signup screens....
Thankyou!