Making the launch image display longer xcode
Solution 1
You can also do it by appliying following code in
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
[NSThread sleepForTimeInterval:2.0]; // Used For Showing Splash Screen for More Time
}
First create the viewcontroller set the image what you want to show as splash screen/Launc image..
Present that view in method applicationDidFinishLaunching: with Animated:No
and write following code in your another view that your presenting
-(void) viewWillAppear:(BOOL)animated
{
[self performSelector:@selector(dismiss1) withObject:nil afterDelay:5.0f];
[super viewWillAppear:animated];
}
-(void) dismiss1
{
[self dismissModalViewControllerAnimated:NO];
}
If you want to show the splash screen every time app opens, then present the splashscreen viewcontroller in applicationDidBecomeActive method
Solution 2
- (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:2]; //add 2 seconds longer.
//other code....
}
Solution 3
You can use the sleep()
method.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
sleep(10);
return YES;
}
Solution 4
Launch images are there to make your app appear really responsive and should be a snapshot of your UI prior to any items on it like tabBars, etc. Apple doesn't really want you to use them as splash screens.
That said, a lot of people do and to achieve this result, your App delegate needs to put the same image on screen as you launch image and then you can delay launching your main app with performSelector:withObject:afterDelay:
Solution 5
In Swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Thread.sleep(forTimeInterval: 2.0)
return true
}
Matan
Updated on August 29, 2020Comments
-
Matan over 3 years
I need help with launch images on iphone. In the project settings on xcode theres an option to add launch images. I added it and it displays for 2 seconds... I want it to be more... How can i change it? Thanks :)
-
EmilioPelaez about 12 yearsYou shouldn't do that. If you show the default image for longer than necessary, it will seem like your app is slow, and that's bad user experience. They already have your app, there's not need to rub your brand in the user's face.
-
rob mayoff about 12 yearsKeeping your launch image up longer is a great way to gather 1-star reviews.
-
Matan about 12 yearsI dont mean longer as in 10 seconds... only 5... 3 seconds longer
-
jscs about 12 yearspossible duplicate of Change iPhone splash screen time
-
-
Matan about 12 yearshi.. what should i write after the selector performSelector: and after the withObject: im new to xcode
-
Magic Bullet Dave about 12 yearsThe selector is the method that you want to run next in the sequence and you use @selector(myMethod) after the performSelector. The withObject is an object you can pass to the method as a argument, if you have no arguments then use nil. Use NSNumber if your argument is a value. The delay is the number of seconds to wait before running it.
-
Vineesh TP over 11 yearsMy launching image doesn't always appear. I want to show launch image when I open application How can I set this .
-
Rupesh over 11 yearsthe above code is for showing launching image for longer time. You can use apple default by adding Default.png in your resources directory. At run time it automatically finds Default.png and shows when app opens.
-
Rupesh over 11 yearsAnswer about "My launching image doesn't always appear" is that app is not killed, when you killed the app from background process. then only it will show the Default.png
-
Vineesh TP over 11 yearsNow testing, when I load first time. It works fine in device then I click on home button again Open it The launching images doesn't come. But, in Simulator showing launch image.
-
Rupesh over 11 yearsdouble click the home button, now long press your app, delete it. Now open app, it will show the launching image
-
Vineesh TP over 11 yearsIt is working fine on Simulator but, not working on iPad device
-
Rupesh over 11 yearsJust Do one thing create a viewcontroller class, place a image which you want to show as launcher image, In that class write following code
-
Rupesh over 11 years-(void) viewWillAppear:(BOOL)animated { [self performSelector:@selector(dismiss1) withObject:nil afterDelay:5.0f]; [super viewWillAppear:animated]; } -(void) dismiss1 { [self dismissModalViewControllerAnimated:NO]; }
-
Maziyar almost 11 yearsawesome! 2 seconds is enough to show off the brand and not piss of the users. Way better than blink of an eye! tnx
-
rmaddy over 7 yearsDO NOT do this. Very bad.
-
rmaddy over 7 yearsDO NOT do this. Very bad.