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