Mac
Mac

Reputation: 373

How to set LaunchScreen image width constraint to superview in xamarin iOS project storyboard file?

I am implementing a splash screen for my app. I just came to know about storyboard constraints to support multiple devices. Basically, I feel it very difficult to understand it as a beginner in this, also I see there is no apt documentation in xamarin also. I want to know the steps to set an imageview width to its super view (View controller).

I see what I should do from here, Visual studio Xamarin iOS launchscreen storyboard layout. But, how do I add those constraints, totally no idea..?! Particularly imageview width and height to superview, trailing and leading

Now, I can only know how to set the constraints in designer by dragging, I'v only learnt to center the image to super view in X and Y (Horizontally and vertically). There is no button to add constraints. How to add leading and trailing constraints? I'm using Visual Studio 2017 for Windows

Upvotes: 2

Views: 1230

Answers (1)

Mac
Mac

Reputation: 373

I got it working.

Step 1: Open storyboard file with lowest screen resolution device set (iPhone 4s) and drag & drop an imageview to fill the view controller.

Step 2: Set the uiimageview source from resources/image assets.

Step 3: Click on the image -> Properties Tab -> Layouts section. You will see like this

enter image description here

Step 4 : Properties -> Layout -> Under View group, there is title called Arrange, there is a autosizing box and example box.

Step 5 : You should click all the I-bars and lines in the center to make it red like below to fill the width (you can see that reflecting in the example box as you click)

enter image description here

Now, SAVE and then switch to other devices, you should have that UIImageview filling the device's height and width.

This will be very useful for important UI auto designs like splash screen.

Upvotes: 4

Related Questions