Change iPhone splash screen time
33,774
Solution 1
You need to create a view controller for displaying the splash screen as done below.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self generateRandomSplashScreen];
[self performSelector:@selector(removeSplashScreen) withObject:nil afterDelay:SPLASHSCREEN_DELAY];
[self otherViewControllerLoad]; // the other view controller
[self.window makeKeyAndVisible];
return YES;
}
-(void) generateRandomSplashScreen
{
splashScreenViewController = [[SplashScreenController alloc] initWithNibName:@"SplashScreenController" bundle:[NSBundle mainBundle]];
[self.window addSubview:self.splashScreenViewController.view];
}
-(void) removeSplashScreen
{
[splashScreenViewController.view removeFromSuperview];
self.window.rootViewController = self.tabBarController;
[splashScreenViewController release];
}
Solution 2
Write sleep(5.0)
in your
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
method.
Solution 3
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
/*this will pause main thread for x interval seconds.
put on the top of application:didFinishLaunchingWithOptions, so it will not
proceed to show window until sleep interval is finished.*/
[NSThread sleepForTimeInterval:5]; //add 5 seconds longer.
//other code....
}
Solution 4
Probably the splash screen you are talking about is "default.png" file. As JustSid mentioned, this file is not intended to be splash screen, rather to be used as a first screen snapshot to improve user experience concerning application loading time. Check human interface guideline
If you want to implement splashscreen, you should use ie. NSTimer and UIView components.
Author by
iOS developer
Updated on November 25, 2020Comments
-
iOS developer over 3 years
How would I make the splash screen stay for longer, 5 seconds, for example?
-
user almost 11 yearsThis is the most clever yet straightforward way to do this.
-
Van Du Tran about 9 yearsWouldn't this freeze your app code for 5 seconds? What if I want to fetch some cloud data while the 5 seconds is happening?
-
Dhara over 8 yearsYes it will be in sleep mode. So nothing will happen.
-
Nicolas Miari about 8 yearsI was under the impression that the operating system (iOS) will kill your app if it takes too long to launch. Have you tested this code?
-
rmaddy over 7 yearsDO NOT do this. Very bad.
-
rmaddy over 7 yearsDO NOT do this. Very bad.