-2

I'm doing my UI for my iOS apps programmatically. The only things that is left is the LaunchScreen.storyboard where I didn't find a way around using it, yet. Strangely I can't find much about that in the internet.

Is there a way to get rid of it and use an AssetSet instead?

LaunchScreen.storyboard

That's (the highlighted file) what I want to get rid of

HangarRash
  • 7,314
  • 5
  • 5
  • 32
Michael
  • 1,030
  • 14
  • 29
  • 1
    I dont think can do that file programatically as it is what is shown as the app is loading. you would normally just add an imageView and an image here that shows whilst the app is booting up. It doesn't allow you to start writing code for this screen as far as I am aware – Scriptable Aug 07 '18 at 09:53
  • Possible duplicate of [Is there any way to code the LaunchScreen programmatically](https://stackoverflow.com/questions/32855526/is-there-any-way-to-code-the-launchscreen-programmatically) – João Fernandes Aug 07 '18 at 09:59
  • No, The launchscreen shows before the app starts, it provide the transition while your app is loading. You can put image of your app on launchscreen to show app is launching. The storyboard scence is actually loaded by the OS, so it is security to excute the code. – Abhishek Jadhav Aug 07 '18 at 10:09
  • It was possible in the times when StoryBoard was relatively new. – Michael Aug 07 '18 at 12:54

3 Answers3

7

Since the question included "use a View or and UIImage instead?"

From Apple's docs...

Static Launch Screen Images

It’s best to use an Xcode storyboard for your launch screen, but you can provide a set of static images if necessary.

Reference page, including a list of required image sizes: https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/launch-screen/

Note: To use images instead of a storyboard...

In Xcode open your Assets catalog (or create a new one), right-click in the assets section and select App Icons & Launch Images -> New iOS Launch Image and it will create the proper template. Also go to project General settings and select Launch Images Source - Use Asset Catalog...

DonMag
  • 69,424
  • 5
  • 50
  • 86
  • Nice! Did you try that? Did you try that? Do I have to add the assets in a specific format and then can delete the LaunchScreen.storyboard? The Styleguides are not very clear about that – Michael Aug 07 '18 at 12:53
  • 1
    Yes... Open your Assets catalog (or create a new one), right-click in the assets section and select `App Icons & Launch Images -> New iOS Launch Image` and it will create the proper template. You can also find lots of utilities and scripts out there for auto-generating all the sizes. – DonMag Aug 07 '18 at 13:18
  • Oh, and they can be jpegs or pngs. – DonMag Aug 07 '18 at 13:19
2

There is noway to accomplish what you want , you have to supply a storyboard file for the launch screen in plist , if you want to customize go to the layout and add image or anything you want , there is no place to configure a programmatically UIView for that

Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87
  • It is possible: see the confirmed answer – Michael Aug 07 '18 at 14:18
  • 1
    he describes how to set the resources , while your question aske for a uiview programmatically , You updated the question it was **Is there a way to get rid of it and use a View or and UIImage instead?** – Shehata Gamal Aug 07 '18 at 14:24
  • Exactly! I wanted to set it without the storyboard file and that was what I was looking for. I was probably not clear enough with my question so I changed it in order to help others with the same problem – Michael Aug 07 '18 at 14:49
1

Here a short description of the steps based on the answer from https://stackoverflow.com/users/6257435/donmag:

  • create a new AssetSet: + -> AppIcons & Launch Images -> New iOS Launch Image
  • Go to your Target Settings to General
  • Under App Icons and Launch Images clear the field Launch Screen File and select your LaunchScreen Asset set that you just created at Launch Images Source
  • You might have to delete the App from the device/simulator that you test it on and the new Launch Image should show up on start
Michael
  • 1,030
  • 14
  • 29