I am a beginner of iPhone developer and I am working on my first apps. Actually, I already created a Tab Bar application well but I would like to add the Splash Screen when run the apps.
I found a exactly question at Loading a Welcome Screen(Splash Screen) before TabBarController
But when I try to put in my code, the splash screen doesn’t load and just keep showing my tabbarcontroller.
I created a SplashViewController.h, SplashViewController.m and SplashView.xib and following is my code,
#import "SplashViewController.h"
...
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
SplashViewController *controller = [[SplashViewController alloc] initWithNibName:@"SplashView" bundle:nil];
[self.tabBarController presentModalViewController:controller animated:YES];
[controller release];
// Add the tab bar controller's view to the window and display.
[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];
return YES;
}
The apps run without error but just cannot load the splash screen, any comment is highly appreciated. Thanks!
My guess is that the tab bar controller is ignoring your call to
presentModalViewController:animated:because it isn’t on screen yet. Try moving the call to after the tab bar view has been added as a subview to the window. It may have to happen even after the call tomakeKeyAndVisible.