问题
I am having an app in which I have a requirement of changing the splash screen every time when the app launches.
I am having 5 images and i want to change my splash screen by one of the 5 images every time user launches the app.
Is it possible to do this?
回答1:
You can't change the splash-screen that shows while your app is loading (that scales up when your app is launched), but you can make it something generic (like a texture or solid colour) then as the first view controller in the app you can load the exact same image (or just use a solid background colour), then you can fade-in one of your five images and show that for a short period before transitioning to the first (real) screen of your app.
For example:
- Splash is solid black.
- Root view controller gets set to a view with solid black background colour and an image-view containing one of the five images, with alpha set to 0.
- Fade in the selected image.
- Transition to first-screen of app.
By making the first view controller look exactly like the splash screen (initially) the cut-transition is seamless and your custom transition to your in-app splash screen can begin.
回答2:
i suggest to leave the splashscreen empty and directly go to another view where you do all the loading and change images there. Changing the splashscreen image at runtime is not possible. Maybe you can make an image like loading or your logo for the splash screen as this will still pop up for a few seconds.
回答3:
It's not possible to do what you want. See App Launch (Default) Images. You can only change the Default image based on:
- Orientation
- Pixel density (retina/non-retina)
- Device (iphone/ipad)
- URL scheme used to launch the app
Your app data is also read-only so you can't get around this by modifying the Default.png file manually.
Also, it's a very bad idea to not add a Default.png file like some other answers are recommending. You will end up with a black screen for a few seconds, which will also appear in the multitasking switcher if your app has been terminated in the background. This is a very bad user experience and your app will look shoddy.
回答4:
There is work around for this.
- Don't load default Splash Screens.
- You can create your own splash screen which will be called every time user open the app.
- You can manage the 5 images in this very easily as control will be in your hand.
来源:https://stackoverflow.com/questions/18637974/want-to-change-splash-screen-every-time-the-app-launches-in-iphone