Ios-autolayout Visualformatlanguage

Source: Internet
Author: User
Tags key string

Visual Format Language Short cut in VFL

A. Nslayoutconstraint.constraintswithvisualformat ("formatString", Options:[nslayoutformatoptions], metrics:[ String:nsnumber], Views:[string:anyobject]), the the method we use in the VFL, let dive into the method.

B.The Formatstring:in This string we use the characters like below:

|:stands for Superview

-:standard value

V:vertical direction

H:horizontal direction

<= or >=: Specify the value relationship

@:specify the priority

The entire string is like:

"V:|-[componenttolayout ([email protected])]-15-|" This was for vertical direction

"H:|-20-[componenttolayout ([email protected])]-|" This was for horizontal direction

C.the nslayoutformatoptions is on-align the different components together, but remember when you in the Vertical dir Ection you can only align the X axis alignment and if you are in the horizontal direction you can only align the Y axis Alig Nment, final the alignment is used to all components appear in the format string.

D.metrics:this is just a dictionary this used to declare the string used in the format string which stands for some nsnum ber value, and we could use NSNumber value directly or constant even computed variable as the value referenced by the Stri Ng Key.

E.views:this is a dictionary so used to declare all the components used in format string like [Component], is a type of [String:anyobject], we use the key string to stands for the component related to the dictionary in the format string.

Sorry guys i ' m using a Chinese blog website, so I had no idea if there was a blog I can use in 中文版, please leave any C Omments below and the related Chinese word is "review", thank you so much for your reading, and if you had any suggestions ple ASE Leave it below.

Ios-autolayout Visualformatlanguage

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.