Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom animation in Launch Screen

I have created a new project in Xcode 7 using Swift. I noticed that the launch screen is stored in the storyboard file.

So I think if it could be customised by referring it to my CustomLauchScreenViewController. However, when I set the custom class name in LaunchScreen.storyboard, it throws an error:

Launch screens may not set custom classnames

So what is the best way to customize the LaunchScreen? I intend to use the LaunchScreen to load some data before launching the main screen.

like image 558
chipbk10 Avatar asked Oct 02 '15 09:10

chipbk10


2 Answers

That's not the purpose of the launch screen. What you can do however if have your first initial viewController 'act' as a launch screen. Just have it display the same image as the launch image and do what you need to do in there. Once you are done, move to your main viewController from there.

like image 112
Robert J. Clegg Avatar answered Oct 13 '22 23:10

Robert J. Clegg


The launch screen is shown before your app starts executing in order to provide a transition from the Springboard to your app while it is loading. According to Apple interface guidelines,

A launch file (or image) provides a simple placeholder image that iOS displays when your app starts up. The placeholder image gives users the impression that your app is fast and responsive because it appears instantly and is quickly replaced by the first screen of your app.

To achieve a transition, remove the class from LaunchScreen.storyboard and set it similar to 0% loading transition. Create a new controller in your Main.storyboard and set CustomLauchScreenViewController there and assign this as initial view controller. Set CustomLauchScreenViewController as your root view controller in your app delegate. When launch screen will be replaced by your this controller, transition is too smooth to feel any difference. After loading the data, change your root view controller to required View Controller.

like image 40
Sahil Kapoor Avatar answered Oct 13 '22 21:10

Sahil Kapoor