1

I created my views in code. The starting point is the didFinishLaunchWithOptions function in the Appdelegate class.

    window = UIWindow(frame: UIScreen.main.bounds)
    window?.makeKeyAndVisible() 
    let controller = ViewController() // create an instance of my ViewController and set it to the rootViewController
    window?.rootViewController = controller

I would like to add a launch screen that appears instantly when your app starts up. The launch screen should be quickly replaced with the first screen of the app, giving the impression that your app is fast and responsive. I found some answers that said it is not possible(Is there any way to code the LaunchScreen programmatically). My idea was creating a new launchView and replace it through NSTimer. Isn't there any easier or alternative way ?

Thanks

Community
  • 1
  • 1
Developer Omari
  • 434
  • 5
  • 14
  • You have two lines taken directly from Apple's Launch Screen Guidelines page ( https://developer.apple.com/ios/human-interface-guidelines/graphics/launch-screen/ ) ... so, if you've read that page, what's your question? Use static images, and write your "startup code" to get to your first UI as quickly and efficiently as possible. – DonMag Apr 05 '17 at 12:04
  • I'm happy to try and help... just asking for clarification of what you are trying to do, if different from what is already in place ? – DonMag Apr 05 '17 at 20:42
  • I took two perfectly written sentences from the guideline about the launch screen so whats the problem ? I described my problem in a good way that I create my views in code and want to include a launch screen. My starting point is the didFinishLaunchingWIthOptions method in the AppDelegate class where I start creating my views. Before asking that question I made some research and tried to find a solution on my own (NSTimer etc.) . Your behavior is not constructive and you just put the focus on something not important instead of helping ! This is embarrassing . Stop it. – Developer Omari Apr 05 '17 at 20:50
  • My suggestion was simple: "Use static images, and write your "startup code" to get to your first UI as quickly and efficiently as possible." ... The default process is: iOS shows your Static Launch image, and as soon as your first view is ready to present, it replaces the image with your view. So I will rephrase my question: Why is that not working for you? Is there something else you want to do? – DonMag Apr 05 '17 at 21:12

1 Answers1

4

This is not possible as such as the Launch Screen is not a regular View Controller and it cannot hold any logic. Any animations which are there in the App during startup are handled after the launch Screen has appeared and the animations are in the root view controller as in Twitter app. If you are completely against using launch Screens then an alternative would be make a view in IB and use its screenShot as a splashImage. There is no way as of now to make a launchScreen programatically or to add any logic to it.

Md. Ibrahim Hassan
  • 5,359
  • 1
  • 25
  • 45