The AutoLayout of learning notes

Source: Internet
Author: User

Align: Used to add alignment constraints.

Pin: Add standard constraints, such as size and position relative to other views.

Reslove Auto Layout issues: allows Xcode to automatically generate constraints, or to update to the correct position based on the border of the constrained handle view.

Resizing Behavior: Can be used to set which classes inherit these constraints.

Pin

Item of new Contrains is when you add a constraint to a view, when you click the "Add Contrains" button, the view frame responds accordingly (but the frame of the sub view does not change).

All frame of Contrainer This view includes its child view of the frame changes.

Resizing Behavior

By default, siblings and ancestors (siblings and ancestors) and descendants (descendants) are selected. But it is recommended to leave silbings and ancestors blank. If siblings and ancestors are selected, the parent and sibling views change together when the view is modified, and if descendants is selected, the view and the child view change together.

Note: Resizing behavior this constraint button is not found in XCode6.3.

Write AutoLayout constraints in code

You need to set the translatesautoresizingmaskintoconstraints property of the view you are using to false.
You can start adding constraint through your code, otherwise the view will still be calculated according to the previous autoresizingmask.
In Interface Builder, the Translatesautoresizingmaskintoconstraints property of the control generated by UEs Autolayout,ib is set to False by default.

Add or remove constraints. For iOS 6 or iOS 7 you can call AddConstraint (s): and Removeconstraint (s): method; for iOS 8 and later versions, set the constraint's active property directly or call Activateconstraints: With Deactivateconstraints: Class method.

Taps

When using the Equal heights/widths Constraint , be aware of the proportional relationship of the two views, and do not reverse the relationship between the first item and the Second item.

Constant indicates the relative distance of the current control's X/y relative to Superview

priority indicates the precedence of the constraint, and the range is 1-1000,1000 highest. You can set multiple constraints to adjust the view changes by the priority level.

The AutoLayout of learning notes

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.