Search code examples
c#iosxamarin.formsorientationsplash-screen

Xamarin Forms - iOS - change splash screen depending on screen orientation


I have a problem with adjusting splashscreen in Xamarin Forms iOS project. I'd like to change splashscreen static image depending on screen orientation. In Android I simply, created drawable-land folder, put there image for landscape orientation and it's working.

In iOS project there is whole designer for purpose of creating launchscreens, but I can't find anything that will do the job. When I adjust image for Iphone, change orientation in designer I can't simply put there different image because it's shared across all screens in designer. One important remark - I found some sources on how to achive that, but for native XCode designer, I need an answer for Visual Studio or VS for Mac.

VS Designer

Thanks in advance


Solution

  • Here whatever you apply, will be applied to landscape and portrait universally.

    You can have different images, one for portrait 'splash_portrait.png' and one for landscape 'splash_landscape.png' in Assets.

    You can then choose which image to display for landscape and which for portrait using Edit Traits button on the bottom right corner in your screenshot.

    Edit Traits

    Landscape uses Any or Compact Height size class, so you would be selecting Compact Height checkbox and whichever change you apply, will be applied for this size class (landscape).

    Please get more details on this, here & here

    Practically, I haven't tried as while giving answer, I am away from computer. But I hope this will help.