Use LaunchScreen ViewController instead of image - ios

I've implemented in my code LaunchScreen as view controller in storyboard and its class is : LaunchViewController also its the initial view controller in storyboard.
I set in the project settings the Launch Screen file is : Main.storyboard.
Actually i don't want to use Launch screen image, just a controller acts like Launch screen, and I'm getting the following warning in Xcode:
Applications using launch screen files and targeting iOS 7.1 and earlier need to also include a launch image in an asset catalog.
How do i solve this warning without using Images, because if i set the launch images in project settings it will automatically show empty screen, then go to my launch screen controller which doesn't make since ?

The solution was to set the Launch screen image and delete all launch images from the attribute inspector and uncheck it all.

For supporting iOS 7.1 and earlier you must to add static generated images.

Related

Abandon image cassetts for LaunchScreen.storyboard

So I have a fairly old app, last time worked on before iPhone X(s) was released. Always used Launch Images Source instead of Launch Screen File as seen below.
I am now having issues launching on iPhone X, as the screen size is assumed from the LaunchImage and there is NO launch image currently provided for iPhone X(s) in the "LaunchImage" file of .xcassets folder.
What is the most straightforward way to abandon using cassets in use of the new "Launch Screen File"? I have already tried creating this and using it, but had no luck getting an UIImageView to resize an image with said screen sizes on devices.
Im really looking for a straightforward guide for creating a LaunchImage.storyboard file that can adapt a launch screen image(full-sized image) to any device size.
What is the most straightforward way to abandon using cassets in use of the new "Launch Screen File"?
Change the Launch Images Source pop-up menu to "Don't use asset catalogs".
Make a LaunchScreen.storyboard if there isn't one, and point Launch Screen File at it. Make sure your launch image storyboard uses autolayout and is designated as a launch screen.
Now configure your storyboard's view controller using autolayout so that it lays out correctly on all devices.

Difference between view controller "use as launch screen" option and launch screen storyboard

I noticed there is a Use as Launch Screen option under File Inspector for a View Controller located in the Main.Storyboard. What is the difference between enabling the View Controller as a launch screen using this method and using the LaunchScreen.Storyboard that XCode provides? Similar questions are about the differences between Main.Storyboard and LaunchScreen.Storyboard but doesn't specifically ask about the Use as Launch Screen option.
The difference is that LaunchScreen.storyboard has this option enabled by default, but you can:
create your own separate storyboard with an initial view controller,
then select it as the launch screen for your app inside the project's settings (Project settings/General/App Icons and Launch Images/Launch Screen file),
...and it will also work in the same way.
Xcode only puts the launch screen in a different storyboard to preserve an organized view structure.

iOS Xcode LaunchScreen Storyboard not displaying

I'm trying to use Xcode's LaunchScreen storyboard as my launch screen? All the questions that have previously been asked about this refer back to the old launch image or .xib method - trying to do it now with the new LaunchScreen storyboard that Xcode automatically generates instead. I've selected the LaunchScreen storyboard as my launch screen file in my Deployment Info:
The storyboard itself confirms that it is set as the launch screen in it's file inspector.
And the info.plist file reflects this as well.
And yet, it doesn't work. The LaunchScreen storyboard never shows - it just goes straight to the first screen in my main storyboard. Using Xcode 7.2 and deploying to iOS 9.
Enable these two settings for the LaunchScreen.storyboard
If you are using xcode 11.2 you'll need to remove the app and execute it again to see the launch screen. I have to do this every time I modify the launch screen in order to see the new changes.
Another thing to make sure is that Launch Screen File is set to Launch Screen.storyboard
**Delete the app from the device. Re-run. **
In my case I had all the suggested settings set correctly but continued to have the original blank launchscreen. In the spirit of AmJa's suggestion regarding a "cache" problem, I deleted my app from my device and reinstalled. Reinstalling did the trick for me on both my devices and simulators.
In case anyone else runs into this issue, I resolved it by simply deleting the ViewController on my LaunchScreen storyboard (leaving me with an empty storyboard), creating a new ViewController and resetting the Storyboard entry point to that new ViewController. There may be some sort of bug with XCode 7.2 with respect to the LaunchScreen storyboard and default entry point into the auto-created View Controller, but then again, I've tried replicating this 3 times and it hasn't ever repeated itself, so maybe not.
In storyboard, in ViewController scene, I had to check Is Initial View Controller for storyboard to be seen as Launch Storyboard.
Suprisingly this is not checked when you add first View Controller. Xcode 11.
Just in case it helps someone.
Scenario, I created my new project and copied a old Launch Image from another project. And then started getting the launch image but when I wanted to change it to new image then still i was viewing the old image it was stuck for ever as launch image no matter what I do.
Then I reset my Simulator and restarted my iPhone and there you go I stared getting the new image. This looks like that somewhere in the documents or cache the devices store the old image until you reset the phone.
Thanks
As #abanet, mentioned in his answer, anyone who uses Xcode 11.2 and above, they have to delete their app and launch it again to see launch screen changes. It's not reflecting immediately. It looks like a bug from Xcode definitely not an intension.
How to fix for Xcode 11.0 and above:
Do this: https://stackoverflow.com/a/41287094/2190175 if you haven't already, and after that:
Delete app from device / simulator
Restart device / simulator
Reason: Launch Screen part of storyboard is cached during development and doesn't change until you remove app from device / simulator and reinstall it completely.
Other solutions didn't work for me, but this did:
Toggle on and off Device Orientation (e.g. support Upside Down) and Hide Status Bar in General.
I'm not sure which one did the trick, but it's working now.
If you don't see anything and your Launchscreen.storyboard only has an ImageView in it, then it might actually be showing the storyboard but not the image. Try putting a button in it or something. I've discovered that my Launchscreen.storyboard is actually showing but won't show any images and I don't know why.
The issue can be also that the "LaunchScreen.storyboard" is not added to this target.
To fix this open "LaunchScreen.storyboard" then press on "File Inspector" and under "Target Membership" add it to the needed target.
I tried everything mentioned here, the only thing that worked for me was creating a new LaunchScreen file. I'm using Xcode 12.1
(Don't forget to update the reference in the targets settings)
I was banging my head against a wall with this since Xcode 10.1 does not include a launch option for the new 11" iPad Pro when you create a new iOS Launch Image set, and without it, the iPad Pro doesn't display correctly, leaving me no choice but to get this working with a Launch Screen storyboard.
I tried combinations of so many things, but I wanted to post what ended up making it work 100% of the time (which was, in fact, a combination of a number of things).
As you have no doubt read, for the UIImageView within the Launch Screen storyboard, you should NOT include the extension (.jpg or .png). So many posts say that, but leave out that the reason is that you should create a new image set within Images.xcassets (NOT Launch Screen image set, but just image set) and name it whatever you want (for instance, "Launch-Default"). Then, drag and drop the desired .jpg or .png into the new image set. You will then use the name of that image set within the UIImageView in the storyboard and everything should work fine (the image should even show up inside of Interface Builder).
Also, within the General settings for the project, make sure to set the Launch Screen File to your new storyboard.
You need to add App orientation specific Launch Screen.
LaunchScreen Portrait: https://app.box.com/s/hfoeuvsy68iu913keb8p5hs1z9fdz3jk
LaunchScreen Landscape : https://app.box.com/s/o9q5nkrvk2ewdh57oiiar85zf658olgj
Drag LaunchScreen.storyboard & LaunchScreenBackground.png to Xcode sidebar. Then specify LaunchScreen in Xcode General page. See attach image
In my case, the problem was that the image for the logo was taken from a different target. Make sure that the image is from the main target of the application, and reset the simulator via menu Device/Erase All Content ad Settings...
In my case a few image views cover the whole parent view of the launch screen (e.g. pinned to the view edges). I had to uncheck the Resize view from NIB in the Attribute inspector for the launch storyboard and finally it worked for me (just do not forget to manually delete the old app from the simulator)
In my case the background color of the view (full screen) was set to a "missing" color literal! After trying all above of course ;(
A jpg image does a problem change the extension to png or use another png image
Worked like a charm for me
in xcode9 swift4 LaunchScreen storyboard, use .jpg image & uncheck clear graphics context for imageview. it's absolutly working.

How to display launch image

I'm a very new to iOS.
My Xcode version is 7.2.1 and I'm trying to run on iOS9 using Swift.
My problem is that I'm very confused with how I should be creating the Launch Screen Image.
I found that there are many ways of creating the launch screen images for different version of iOS.
Can someone please explain to me how to setup my launch images?
The process I've followed is:
I create Launch Screen.storyboard I create different sizes of
launch screen images in Photoshop.
In General tab, Choose Main Interface "Main".
In App icons and launch images> Launch images source "Brand Assets".
I click on the arrow beside of Brand Assets, and then I put different sizes of images. (iPhone- iOS 8,9 , iPad- iOs 7-9 (Portrait and landscape), iPhone portrait).
Launch Screen File is "empty". I didn't choose anything.
After all I run on iPhone 5 simulator. It did not show anything and just black screen appear.
One thing I want to know is that do I need to put a UIImageView in my Launchscreen.storyboard?
Isn't it automatically retrieved from the Images.xcassets folder?
you can set Launch Screen like this
step 1: Go to Target -> App icon and luanch images
step 2:
step 3: LaunchScreen.storyboard
When you start a new project, you get LaunchScreen.storyboard below are the steps you should follow:
Put Image View in the viewcontroller present in the LaunchScreen.storyboard
Use autolayout to adjust the image view as per your need.
Select the imageview, go to attribute inspector and change the image.
Hit run

how to setup ios launchscreen.xib with LaunchImage in image.xcassets

I am using Xcode 6.2 . It now comes with a LaunchScreen.xib . I also have a splash screen image in my image.xcassets.
Should I integrate the splash screen image into a imageview in the xib file? I tried this, and it does not let me put that image file in the interface builder.
How do I accomplish this?
I'm not sure if this was the best way, but I actually removed the LaunchScreen.xib file from my project and indicated the Launch Images Source to be the LaunchImage within the images.xcassets folder. I even removed the LaunchScreen from the Launch Screen File and it works how I want it to now.
Image below is from my project's target General tab.
Launch image is basically needed for devices before iOS 7.1 and launch nib is new feature in devices after that.So I put launch images and launch nib both in my project
Xcode 6 allows use a LaunchScreen.xib for iOS8+. It the best way to create a launch screen if your app:
Support only iOS8+, previous version need a launch image source.
If your launch screen is simple and you can get it using UILabel or other UI objects supported in launch screen xib.
Why use LaunchScreen.xib? Because you can support all the screen devices with one file if you setup the auto layout properly. And believe me, it's great if you're coding a universal app.
If your launch screen has a more complex design (logos, custom typography...) you'll have to use launch images sources and you'll have to create one image for every screen sizes.

Resources