Some simple introduction to iOS AutoLayout and how to use it

Source: Internet
Author: User

One. Use of AutoLayout:

Mainly used for screen adaptation, especially after the iphone6,plus has occurred.

Two. How to use AutoLayout?

Click on the left one to see:

Click on the left two:

Basically want to AutoLayout, will be in these two buttons on the fuss.

Then do an exercise, such as:

The width is 100, and then centered, regardless of how the view is reversed, always centered

One. There are two constraints: width, height, center:

  1. . The width and height are all 100:

  2. Centered (view with respect to the emulator)

  3. OK, you'll find a little reminder on the top left. Such as
  4. There is a yellow dot, indicating that you set the constraints are right, but you set the constraints of the object does not have the correct frame, but Xcode for us to do a little, click on the yellow dot, the default is update frame, click Fix, Yellow disappears, you are done,

    You may also find that there is a red dot, which may be a constraint is not enough, or a constraint conflict. Need to check constraints, generally, it is best to click below, the fastest check constraints.

Some simple introduction to iOS AutoLayout and how to use it

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.