How to set launch screen in Xamarin iOS to images in Assets.xcassets directory?

mshwfmshwf EGMember ✭✭

I need to set up a launch screen for a Xamarin iOS app (part of Xamarin Forms app), I'm following this tutorial, but there I can only set the launch screen to only one image, I want to make sure that it will be displayed the same across all devices. I have added all sizes required in the Asset Catalogs> Assets> LaunchImages

and set the the Launch Screen to LaunchScreen in the Info.plist but the assets images are not available in the image drop-down list (only images in the same directory of the LaunchScreen.storyboard), so, the LaunchScreen dosn't have access to the assets folder of the Asset catalogs!

Any help?

Answers

  • SreeeeSreeee INMember ✭✭✭✭

    I prefer the following method for creating launch image in xamarin forms. This is very easy and most effective, no need to create the different size launch images.

  • LandLuLandLu Member, Xamarin Team Xamurai

    @mshwf If you want to use Asset catalogs in the LaunchScreen.storyboard, it is not necessary to name the Asset file as LaunchImages. Click the add button at the left top of this window, you will get an Asset file named Images. You can rename it then add three sizes of images(1x, 2x, 3x), after doing that this image can be used adapting all apple phone devices.

    Then click save all button at the top window or use Ctrl + Shift + s to save this behavior. At last drag and drop down an Image view control on the LaunchScreen.storyboard, you will find this image called the Asset file's name instead of the images' original name in the image view's property window's image list.

  • mshwfmshwf EGMember ✭✭
    edited August 1

    @LandLu said:
    @mshwf If you want to use Asset catalogs in the LaunchScreen.storyboard, it is not necessary to name the Asset file as LaunchImages. Click the add button at the left top of this window, you will get an Asset file named Images. You can rename it then add three sizes of images(1x, 2x, 3x), after doing that this image can be used adapting all apple phone devices.

    Then click save all button at the top window or use Ctrl + Shift + s to save this behavior. At last drag and drop down an Image view control on the LaunchScreen.storyboard, you will find this image called the Asset file's name instead of the images' original name in the image view's property window's image list.

    This is surprising!
    why the Launch Image set is not available in the story board while an image set is available!

    also the the images in the LauncImage include a broad variety of images at different positions and sizes: iPhone Portrait, iPad Portrait and iPad landscape, instead of only three images 1x, 2x, 3x?

    currently I have already these sizes: 640-960, 640-1136, 768-1024, 1024-768, 1536-2048, 2048-1536

  • LandLuLandLu Member, Xamarin Team Xamurai
    edited August 1

    @mshwf Launch Image and Launch Screen are two ways of setting the splash screen before app has launched.
    .
    On iOS 8+ we can create a special Unified Storyboard to provide the Launch Screen instead of using one or more static launch images for each device.

    Using launch screen you just need three sizes for iPhone and two sizes for iPad, setting the autolayout to fit your request, here is the documentation about launch screen. If you want a good performance on iPad and iPhone, you can use two launch screen files. In the Info.plist file, create another entry called UILaunchStoryboardName~ipad and set it to your LaunchScreen file:

    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
     <key>UILaunchStoryboardName~ipad</key>
     <string>LaunchScreenForiPad</string>
    

    In this way, you just need to place one image view control on each launch screen file. Then set its image to your two Asset files(one for iPhone, another for iPad). This is more easier than Launch Image.

    Also you can just use Launch Image, after setting images for the six situations above. Set the source to this launch image file, and make the launch screen not set(in the image I post).

  • OleksandrBVOleksandrBV Member

    Is anyone struggling with splash screen in VS 15.8.1 as me? It just doesn't want to work and makes me crazy - neither launch images, nor Default.png, nor image on storyboard. However, storyboard by it self shows up, I can even add labels to it or change background color but it doesn't show image. :(

  • ArtemPavlovArtemPavlov USMember

    @OleksandrBV said:
    Is anyone struggling with splash screen in VS 15.8.1 as me? It just doesn't want to work and makes me crazy - neither launch images, nor Default.png, nor image on storyboard. However, storyboard by it self shows up, I can even add labels to it or change background color but it doesn't show image. :(

    I have the same issue. It just doesn't work in VS 15.8.1. Furthermore, the Image drop down for Image View is grayed for unknown reason.

  • mshwfmshwf EGMember ✭✭

    @LandLu could you have a look at this question please, I googled the problem and found myself in my question!
    I left the problem since then, but now I have to solve it!

Sign In or Register to comment.