IPhone SDK: Stuck on Two views apps
I want to create log in app.
In log in process I create a UINavigationController
to do navigation.
After log in, I want to jump to a UITabBarController
window.
Therefore I added a UINavigationController *navigationController;
and set it as a primary view.
And UINavigationController *navigationController;
to handle stuffs after log in.
and I use
UITabBarController *aTabView = [[UITabBarController alloc] initWithNibName:@"TabWindow" bundle:nil];
[self setTabControl开发者_C百科ler:aTabView];
[navigationController.view removeFromSuperview];
[self.window addSubview:[tabController view]];
to change to the content view.
However, it does not show the content of TabWindow.xib
I suggest creating a viewcontroller on itself for the login view, something that subclasses UIViewController
You can then initialize your app with a UINavigationController
with the root view of a UITabbarController
.
Once the view has appeared for the first time (you could just pick whenever you initialize the initial UINavigationController
) do this line:
[navController presentModalViewController:[[[LoginViewController alloc] init] autorelease] animated:YES];
and then when the user logs in do (in the LoginViewController class)
[self dismissModalViewControllerAnimated:YES];
And the viewcontroller will hide the nav controller and the tab bar initially but then allow it to be seen after the user logs in!
精彩评论