In a tabbar based application, I have created a splash screen and set it as a root view controller. In the splashViewController, I want to set the tabbar controller as the windows rootViewControoler.
SplashViewController *splashViewController = [[SplashViewController alloc]initWithNibName:nil bundle:nil];
splashViewController.loginview = loginview;
self.window.rootViewController = splashViewController;
//SplashViewController
[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(animationFinished) userInfo:nil repeats:nil];
-(void)animationFinished
{
Appdelegate *delegate = (AppDelegate*)([UIApplication sharedApplication].delegate);
delegate.window.rootViewController = delegate.tabBarController;
}
All the code runs without any error, animation finished method is also called. However, the splash screen always stays and user is not redirected to tabBarController even after I set the windows rootViewController as tabbar Controller. What is that I am doing wrong?
It would be simpler to start out with the tab bar controller as the root of your application and, if you absolutely must have a splash screen, present it as a modal display. That way, when you dismiss the modal controller, you just continue with the real application.