I am new to iPhone development. I am developing a TabBarViewcontroller App (iPhone and iPad) and in that I've created one LoginViewController and a Button Action.
My expectation is after clicking that Button, the control will move from LoginViewController to TabBarViewController. In this TabBarViewcontroller I have 5 Tabbar (items) ViewControllers.
Is it possible?
If you can, please share your ideas.
First of all, take UINavigationController and UITabbarController in your MainWindow.xib and bind IBOutlet to respective fields.. ans set LoginViewController as rootViewController of your UINavigationController..
Then in didFinishLaunchingWithOptions method write this..
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self.window setRootViewController:navController];
[self.window makeKeyAndVisible];
return YES;
}
Now create other method in AppDelegate.m like this..
-(void)loadApplication
{
[navController pushViewController:tabbarController animated:NO];
}
On your Login button action.. call this method as follows..
-(IBAction)btnLoginTapped:(id)sender
{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
[appDelegate loadApplication];
}
So in button action try following codes
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
appDelegate.window.rootViewController = tabBarController;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With