iOS: Update launch screen dynamically - ios

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.

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.

Related

iOS development - launch screens where image on main screen can change?

So I am new to iOS development and I have a question about the launch screen.
My app will have an image (that loads when the app opens from the internet) this can change anytime the image is updated on the website, so what is the done thing when designing a launch screen as the image could be different to what is on the launch screen?
Thanks
In Apple's Human Interface Guidelines, they suggest that the launch screen should match the first screen of your app. In the example they give, the only parts of the launch screen are the non-dynamic parts (the UI around the web content).
Design a launch screen that’s nearly identical to the first screen of your app. If you include elements that look different when the app finishes launching, people can experience an unpleasant flash between the launch screen and the first screen of the app.
The launch screen is presented before your app loads, and it should be used for static content only.
If there are any UI elements around the image that is displayed, show those in your launch screen. If not, choose a neutral background color that works well with the theme of your app.
Omit the image. A launch image should be a bare outline of what the screen will certainly contain. It might be no more than the correctly-colored background. It is just to cover the gap between nothing and something.
Read the Guidelines: https://developer.apple.com/ios/human-interface-guidelines/graphics/launch-screen/ Look at the picture on the left. That's a launch screen — basically empty.
LaunchScreen image is always the same..
You can set it in LaunchScreen.storyboard
The launch screen is used to display something whilst your app is initialising, making network requests or whatever.
You shouldn't be looking to load dynamic content here as if a user is on a very slow connection then they wont see anything until your image has loaded. This is why it doesn't have a view controller associated with it. it should be static.
You should only really be loading your logo or something in here, you could just use the company name. it will only show for a short amount of time. then when assets change, submit the changes to store

How to use launch image set in UIImageView iOS?

I have some issues with the launch screen images, when the app is started. I currently using the default image set that contains the #1,2,3x images, but I figured out that there is also an Launch Image Set. This will solve also the problem of different iPhone sizes with the export for multiple screen resolutions. But after uploaded the correct images to the launch image set, I can't select them within an UIImageView in the launch storyboard. Is this even possible and if so, how can I use that in storyboards? Or is there another way to do this?
I cycle through an x amount of images that will randomly display when opening the application. So every time you open the app, it will display another image.
You can't use launch images in the rest of your storyboards. You should create a normal image set to use in the rest of your app and use constraints to get it to adjust size to whatever device the app runs on.
The launch image is shown while your app is loading ("launched", loaded to memory). So you can not run any code at this time.
As the launch time is not that long, a common approach is to initially show a view, that looks 100% identical to the actual launch screen for 3 seconds or so. So you can do run code, animations or such there.
In my personal user experience this is an ugly approach, as you let the user wait for no reason but to show of you CI.
To sum it up: You can not have a random initial launch screen.
Find more information about how to actually setup a launch screen in this answer.

iPhone SDK - possible to have multiple splash screens?

I'm making an app with a different screen for its first run. Once it has completed its first run, this screen is never shown again. The issue I have is that my launch image is built to look like the view that the user sees every other time they run the app, so at first run the loading screen looks weird. Is there any way to have one loading screen for first run and one loading screen for other runs? Thanks
You cannot have multiple or dynamic launch images. Even with the new storyboard/nib launch files, they are still quite static.
Make sure to open an enhancement report with Apple, requesting this feature.
In the meantime, consider a slight change of your flow to first display the initial view, and have an animation to display your first-launch view. This way, the transition will be smoother and more natural to your users.

How to make my LaunchImage load at the same time as the application?

As the application loads, I want to make an image load at the same time, for example, a line would elongate form either side as the application loads, and when it has finished, the line would have reached its maximum length. I have seen this in a few websites, like rime arodaky for example, but I want to this for an iOS application. I have searched on Google but couldn't find anything!
Does anyone know how to do this?
The launch process if we REALY simplify it to accommodate your question, can be split into two parts.
The first part you do not have any control over, and during which a launch image is shown.and it ends with a delegate call-back on the application delegate called
applicationDidFinishLaunchingWithOptions
The second part is you might have some application specific behaviour which requires no activity from the user but you app still isn't interactive.
You need to implement such a progress bar yourself. There is no built in support for this in any of the app templates in Xcode.
You can only do what you want during this second phase. But you have absolutely no control over the first phase, except for that static non-animated launch image.
I think you can just add a photo as a launch image, launch image is just an image.Then you can add the animation when your first view controller appears.You can fake it this way.

Show splash screen only once IOS

I understand, Its a HIG violation to play around with the default launch icons and splash screens, but I have requirement such that, I need to display the splash screen only for the first time, Is it possible to implement it ?
One simple solution, I can think of is : displaying as an imageView on top of UIwindow and then removing it based on a timer. Am looking for other options.
My advice is to rework your view hierarchy so that the first view mimics the splash screen you wish to show (A view controller with a uiimage embedded should work fine for what you've described). Then push the "main screen" over top of that view after your specific period of time. A little code to ensure that this happens only on the first run with some persistent storage and you should be good to go.
I do not advise working with UIWindow directly. Doing so can lead to all sorts of headaches.
That is to simple.
But you aren't need to manipulate the launch image, but an image loaded by your app.
To prevent to launch the second time you can set a flag in the internal storage.
Make sure to use a lazy load / initalization technique and display the image fast as much is possible, than do the initializations.
I hope it helps!
If you use iOS6, you can use restoration feature.
At first run your app will show launch image. All other runs it'll show last state screenshot.
So you know its a HIG violation but looking for some workaround.
You have to have a launch image while uploading the app and showing on first launch.
I assume you dont care about app review in appstore.
Lets think
Launch image has to be in main bundle. And the main bundle is readonly for your code.
I have some workaround but it may work only for second time launch to show the launch image and then no again.
Add your launch image with any name
Add a symlink to your app bundle with name Default.png, which shows the file in 3. step
Copy that launch image to your app directory folder (your symlink in app bundle shows the file) on first launch.
Launch second time the app and see the launch image
Delete the copied image.
When your app can not find a png file which showed by your symlink it can not show launch image
PS: Personally I did not try that but may work.

Resources