2

Is it allowed to set the splash screen image by code.
Since I need to change it many times ?

David Ansermot
  • 6,052
  • 8
  • 47
  • 82
Ahd Radwan
  • 1,090
  • 4
  • 14
  • 31
  • What do you mean by 'applicable'? – Jerry May 04 '15 at 10:35
  • I guess no, for that you have to create your own screen – Inder Kumar Rathore May 04 '15 at 10:35
  • 1
    The launch images are in the IPA with special names at a special place, so you can't change the IPA in any methods. – jayatubi May 04 '15 at 10:37
  • As has been mentioned, this looks like a duplicate question. Anyways, the answer is no. There are two reasons: one is that the code is just loading up hence you can't have your code do the work for you. Second, the splash screen is used for perceived performance. It takes minimal resources to show a static splash screen. – Jerry May 04 '15 at 10:40

4 Answers4

11

You can't.

You have to create your own splash screen displayed right after the default iOS one of your application.

David Ansermot
  • 6,052
  • 8
  • 47
  • 82
4

When launch screen is being displayed your app will be in loading state.

Even the - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions will not be completely executed while the launch screen is displayed.

So it's clear that, you don't have any access to your app and so at this point you can't execute any code.

Tiep Vu Van
  • 975
  • 8
  • 13
2

You can only load single image as Splash Screen when App Launches..

But if you want to launch any image programatically..Before App loads home screen like splash screen..you can use as below at

didFinishLaunchingWithOptions delegate method of AppDelegate..

UIImage *splashImage = [UIImage imageNamed:@"Splash_Img.png"];
    UIImageView *splashImageView = [[UIImageView alloc] initWithImage:splashImage];
    splashImageView.frame=[[UIScreen mainScreen] bounds];
    [self.window.rootViewController.view addSubview:splashImageView];
    [self.window.rootViewController.view bringSubviewToFront:splashImageView];
    [UIView animateWithDuration:1.5f
                          delay:2.0f
                        options:UIViewAnimationOptionCurveEaseInOut
                     animations:^{
                         splashImageView.alpha = .0f;
                         CGFloat x = -60.0f;
                         CGFloat y = -120.0f;
                         splashImageView.frame = CGRectMake(x,
                                                            y,
                                                            splashImageView.frame.size.width-2*x,
                                                            splashImageView.frame.size.height-2*y);
                     } completion:^(BOOL finished){
                         if (finished) {
                             [splashImageView removeFromSuperview];
                         }
                     }];

Above code is not splash screen. But it loads before home screen loads.

David Ansermot
  • 6,052
  • 8
  • 47
  • 82
Vidhyanand
  • 5,369
  • 4
  • 26
  • 59
0

No, you cannot change Splash screen, app icon or app name programmatically.
They all stay static can't be changed.
But you can create your on custom splash using UIImageView and can change it programmatically.

David Ansermot
  • 6,052
  • 8
  • 47
  • 82
Britto Thomas
  • 2,092
  • 1
  • 15
  • 28