iOS Development Swift-5-Auto Layout AutoLayout-Shake the Dice App

1. In the iOS coordinate system, the positive direction is left and down. The picture is based on the upper left corner.

 2. Open the previous dice shake app, and make some effects on its interface to adapt to all iPhone models.

 3. First make a y-axis constraint and a width-height constraint on the logo above.

Width and height constraints:

 Center horizontally:

 Constrain the y-axis. Click on the dotted line to turn it into a red solid line, which means that the vertical distance between the adjacent view dice 1 and the bottom of the logo is fixed, which is relatively constrained. Controls that are relatively constrained must also be constrained.

 Therefore, it is safer to perform relative constraints relative to the security view.

 4. Set the stack View layout for the two dice.

Guess you like

Origin blog.csdn.net/LYly_B/article/details/132594597