iOS: Update launch screen dynamically
Asked Answered
M

1

9

I've designed a launch screen using story board. It's supposed to have 3 images. 2 of these are static, where as, i need to update one at run time (after downloading that from server).

My understanding is that we can not add code for launch screen as there is no controller for this at backend.

What i want to do is to use some default place-holder for the first time. Download & cache that dynamic image at some other point in application. And when user use the app for the 2nd time, show the cached image.

Any solution? Can i update xcassets at run time? Or can i update the image using keypath?

Update: Just found that launch screen and splash screen are 2 different things (Link). Adding content in launch screen dynamically is not possible. Whereas, using splash screen (without any need) is not recommended.

Mown answered 27/1, 2017 at 10:58 Comment(12)
I can give you one hint like you want to display one image downloaded from web before home page. So you could set splash screen exactly before home screen, so its one kind of launch screen that you make.Phallic
Just check this answer It will help you #30028460Phallic
You can have code in the launch screen so just so save the server image in docs folder and then on launch screen check if it exists, if so put that in, I think this should work ?Forcer
@SeanLintern88 you can't have code in your launch screen!Harquebus
Thats weird because I am using the 'Launch screen file' in project settings as a storyboard, which has 1 VC in it which is linked to a file that performs and animation, then transitions to another screen, and it all worksForcer
@SeanLintern88 just a label an update the value of it in the viewController, you will see nonthig happens.Harquebus
@SeanLintern88, i'm unable to do that.Mown
I perform an animation which I see everytime :/Forcer
can you kindly explain in the answer section, how you created launch screen and added code? As, as per my knowledge, we can not.. If it's possible, then every thing will be solved! @SeanLintern88Mown
The thing is, Its in an inherited project that is very messy, there could be other things going on that are not obvious from initially lookingForcer
I would suggest just making a dummy screen as mentioned beforeForcer
@SeanLintern88, thank you :)Mown
H
12

This is not possible, the story board used at launch time is in the main bundle of the application which is readonly and can not be changed.

Also you (edit) can't run any code on startup, since your app is not running.

Harquebus answered 27/1, 2017 at 11:9 Comment(8)
What about my comment above? Will it solve some kind of it or not ? I know this is not possible, but it is possible to do like thatPhallic
Yes you could load a second screen after the launch screen, that is possible. But you don't want to delay the starting of your app.Harquebus
hmm, and also I think it will more delayed for downloading image and then display for fix amount of time. So its better not to do that. ThanksPhallic
@rckoenes, can't we use runtime? like keypath etc? or can't we update xc-assets programatically??Mown
@FayzaNawaz no, since the launch screen is used will your app is loading therefor no code is running and the assets used by the launch screen are again in the main bundle which is readonly.Harquebus
One quick question. How does facebook achieve this? When user is not signed in, the launch screen (NOT Splash) is full blue. But when user signs in the launch screen is white with a blue tabbar at the top. Yes i am talking about launchscreen and not splashscreen. I know the differenceRecitation
Bit late, but for me it shows the launch-screen in both account with the white-background and tabbar.Harquebus
This goes against apple guidelines that launch screen should mimic the first screen of the app. The first screen of most apps depends on whether user has previously logged in or not, so you wouldn't know which screen to mimic developer.apple.com/design/human-interface-guidelines/ios/…Osber

© 2022 - 2024 — McMap. All rights reserved.