Visual studio Xamarin iOS launchscreen storyboard

2019-08-23 00:14发布

问题:

I can't seem to wrap my head around how the storyboard editor in Visual Studio works. My design department has provided me with some images to be used as the splash screen of our App, and I'm to put them in the launchscreen.storyboard and align the correctly. However, the whole editor doesn't make any sense to me. I've been reading about constraints, and trying them out in Visual Studio, but the system doesn't seem to do anything I want. It's always doing something else than I was expecting.

The launchscreen consists of three images. The first is a background, it should fill the entire screen. The second one is a footer. It should be shown at the bottom of the screen, with fixed margins to the left, right and bottom, showing it in the correct aspect ratio. The third is an icon that should be shown in the center with a fixed left and right margin. How can I go about this? Is there anyone who can point me to an example? Or who can explain the required constraints to me?

回答1:

You should be aware of that all the constraints set on the control determine its position(x,y) and size(width,height).

First one

fill the entire screen

top ,leading, trailing,bottom margin to superview euqals to 0.

Second one

at the bottom of the screen, with fixed margins to the left, right and bottom, showing it in the correct aspect ratio

fixed leading , trailing , bottom margin to superview , and aspect ratio plus.

Third one

shown in the center with a fixed left and right margin

Here the constraints are insufficient, the image can't know its height, we should set a fixed height or aspect ratio on height.


PS (about how to set aspect ratio)

click the height handle and aspect ratio

double click the height constraint in Layout menu.

modify the multiplier.