My app was working great and then client asked to put a login screen on.
I have a TabBarController with 4 tabs and I assign it the window as such in my app delegate.
[self.window addSubview:self.tabBarController.view];
Next, I had to put a login screen (view Controller) so I did it and called it like this
[self.tabBarController presentModalViewController:passwordController animated:NO];
and then dismiss it when the login is correct.
Now, when I put the app in the background each time I get my login screen (YEAH) with the exception of one. One of my tab’s calls a navigation controller (well MasterViewController here is actually a view controller) and I call it like this
MasterViewController *masterViewController = [[MasterViewController alloc] init];
//TRYING TO GET IT TO STAY WITH TAB CONTROLLER
UINavigationController *navController = [[[UINavigationController alloc]initWithRootViewController:masterViewController] autorelease];
[self presentModalViewController:navController animated:YES];
and dismiss it when I need to. From there I am doing a bunch of core data stuff and I wanted my tab bar to disappear as I wanted the user to add/edit order in the correct order and not jump around to another place in the app using the tab bar (and then data being out of sync).
When I need to “drill down” to the next level I use
[self.navigationController pushViewController:eventController animated:YES]; and pop when I need to dismiss it.
So my question is this…I want the login screen to be presented on top whenever I return from the background on all screens.
I am sure the problem is the creation of the NavigationViewController not being part of that tabBarController
I did not include more code because it’s all core data stuff or view controllers and all works well.
I am sure I am doing something terribly wrong and just don’t understand (and I’ve built the entire app using advice on here so perhaps I followed bad advice).
I solved the problem like this..I created a navigation controller for each of the tabs that needed to “drill down” and had those navigation controllers initialized using the tabbarcontroller. Then in the app delegate when the appfinishedLaunching I called the security controller and it works everywhere. Just wanted to post for those who might be interested.