AUTOVFL (FIT)

Source: Internet
Author: User

1. Adding Constraints (System)

A. A constraint (up or down)

+ (Instancetype) Constraintwithitem: (ID) view1 attribute: (nslayoutattribute) attr1 Relatedby: ( Nslayoutrelation) Relation Toitem: (ID) view2 attribute: (nslayoutattribute) attr2 multiplier: (cgfloat) Multiplier constant: (cgfloat) C;

B. A set of constraints (horizontal, vertical)

+ (Nsarray *) Constraintswithvisualformat: (NSString *) format options: (nslayoutformatoptions) OPTs metrics: ( Nsdictionary *) Metrics Views: (Nsdictionary *) views;

2.VFL Common parameters

function Expression    horizontal direction  H:  vertical Direction  V:    views [view]  Superview (parent view)             |   relationship >=,==,<=   space, Gap -   priority @value

3. Using the VFL

A. View dictionary

Nsdictionary *dict2 = nsdictionaryofvariablebindings (Button,button1);

B. Parameter dictionaries

Nsdictionary *metrics = @{@ "padding": @,@ "height" : @+};

C. Specific use

/**    /*array3 = [Nslayoutconstraint constraintswithvisualformat:@ " h:|-[button1]-| " options:0  metrics:nil views:dict2];     *array4 = [Nslayoutconstraint constraintswithvisualformat:@ "v:[button]-padding-[button1 (==height) ]" options:0  metrics:metrics views:dict2];    [Self.view Addconstraints:array3];    [Self.view Addconstraints:array4];

AUTOVFL (FIT)

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.