Change splash screen image programmatically [duplicate]

心已入冬 提交于 2019-11-27 06:28:09

问题


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


回答1:


You can't.

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




回答2:


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.




回答3:


Neah, You can't. Sorry!!!

The default image for an iphone app must be a fixed image file in your bundle. You cannot change it dynamically.

Though you can add animation to make it creative.




回答4:


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.




回答5:


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.



来源:https://stackoverflow.com/questions/30027960/change-splash-screen-image-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!