Wednesday 9 May 2018

Xamarin - Create Launch Screen for iOS

Before iOS 8, creating a launch screen for an iOS app required the developer to provide an image asset for each of the various device from factors and resolutions in which the app could run. Therefore, you may ask you designer to come out different size of images base on official spec.

With the new Launch screen, you are recommended to use StoryBoard. Use the iOS designer to add image view and label to the storyboard, and set the constraints on those views, and to verify that looks correct for various devices, etc.

Right,...the most common problem:

Why all the images used in launch story board not appear in device? 


Right,.. after few minutes of research and testing, here are the solutions:

1. In your iOS project, double click the 'assets.xcassets' folder.  Then you will see:
- AppIcon
- LaunchImage

2. Right click on the white space, choose create new image set.  Note: you can create as many image set you like. E.g. If you going to use 2 images in the launch story board, then you probably need two image set.

3. Upload your image to 1x, 2x and 3x. (Not sure what R4 is...)

4. In your Info.plist / under the iPhone Launch Images:
- Source: None (because you are not going to use anything from 'launchImage'.
- Launch Screen:  will be your launchScreen.Storyboard.

5. This step is the most important step!!  Within your launchScreen.storyboard,.. all the image used within this board should be just the file name, with NO extension.  E.g.: if you have image named 'logo@2x.png' ,   then, please use 'logo', that's all.

6. Just incase if the image still not appear, please make sure there are set to bundle resource in resources folder.

Last things last...
if still not appear, do this as well:

"I was messing around with this for hours too. But i found the solution now. You need to add the image to your project and also to the asses.xcassets via drag and drop." 



No comments:

Post a Comment

How to run unit test for your Xamarin Application in AppCenter?

How to run unit test for your Xamarin application in AppCenter?  When we talk about Building and Distributing your Xamarin app, you m...