AutoLayout Automatic Layout

Source: Internet
Author: User

AutoLayout Automatic Layout technology

After the introduction of AutoLayout , AutoLayout technology is more convenient to solve the iOS system in a variety of screen size adaptation problems, with the improvement of the function is not difficult to see Apple is also in the main push this automatic layout of the technology

The two points that AutoLayout must understand are:

1. Referential

2. Constraint conditions

AutoLayout and frame must choose from two, so-called fish and bear Paw can not be combined.

In fact, AutoLayout technology is the same as the final goal to achieve by reference and constraint-that is, to set the control's position in the parent control.

Let's take a look at the example below:

We're going to set the button's position in the controller.

123

At the bottom left, click on the two-grid stack of markers to see that the bottoms are horizontally aligned and aligned vertically, with our choice of horizontal alignment as an example, and then select within the update frame, items of new constraints We then select Add 1 The Constaint option updates the location of the button, but the effect is not the same as we imagined. The center is centered but the height changes because we haven't set up his other location information, you have to know the control's width height and horizontal ordinate when the control is displayed correctly on the parent control, and then we continue to set it. 4.

Then we select the second option below, click on the red dashed line on the cross, when it becomes solid, I enter 60 in the upper box, which means that the distance above him is 60 (equal to its Y coordinate is determined to be 60), Click on the width and height below to set its width to 100 and 30 respectively, because the width has been determined plus we have previously set the center, so it is equivalent to determine its x-coordinate, so that X,y,width,height has a value that is to determine his position.

5.

Complete

AutoLayout Automatic Layout

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.