Simple automatic layout with third-party framework Keep layout

Source: Internet
Author: User

Previously wrote a masonry to achieve automatic layout of the essay, today bored to find another automatic layout of the third-party framework keep layout, the use of feeling more simple than masonry, compared to easy to understand?

Attached Source Address: https://github.com/iMartinKiss/KeepLayout

A description of some properties:

Relationships between attributes and precedence:

For more information, please refer to the website description.

Enclose the code for the simple automatic layout as well:

1- (void) Viewdidload {2 [Super Viewdidload];3     //additional setup after loading the view, typically from a nib.4     5 [self setupfourviews];6    7 }8- (void) Setupfourviews {9     TenUIView *redview =[[UIView alloc] init]; One      ARedview.backgroundcolor =[Uicolor Redcolor]; - [Self.view Addsubview:redview]; -      the      -UIView *blueview =[[UIView alloc] init]; -Blueview.backgroundcolor =[Uicolor Bluecolor]; - [Self.view Addsubview:blueview]; +      -UIView *greenview =[[UIView alloc] init]; +      AGreenview.backgroundcolor =[Uicolor Greencolor]; at [Self.view Addsubview:greenview]; -      -      -UIView *purpleview =[[UIView alloc] init]; -Purpleview.backgroundcolor =[Uicolor Purplecolor]; - [Self.view Addsubview:purpleview]; in      - [self Testwithredview:redview blueview:blueview]; to      + [self Testwithgreenview:greenview purpleview:purpleview]; -  the } *- (void) Testwithgreenview: (UIView *) Greenview Purpleview: (UIView *) Purpleview { $     Panax NotoginsengGreenView.keepBottomInset.equal = -;//the bottom spacing from the parent view is -GreenView.keepLeftInset.equal = -;//left spacing from parent view is theGreenview.keeprightoffsetto (purpleview). Equal = -;//the right distance from the Blueview is +GreenView.keepHeight.equal = -;//height is AGreenview.keepwidthto (purpleview). Equal =1;//width and Blueview equal the      +Purpleview.keepbottomalignto (greenview). Equal =1;//align with the bottom of the Redview -PurpleView.keepRightInset.equal = -;//the right distance from the parent view is $Purpleview.keepheightto (greenview). Equal =2;//twice times the height of the redview. $ } -  -- (void) Testwithredview: (UIView *) redview Blueview: (UIView *) Blueview { the      -RedView.keepTopInset.equal = -;//the top distance from the parent view isWuyiRedView.keepRightInset.equal = -;//the right distance from the parent view is theRedView.keepLeftInset.equal = -;//left spacing from parent view is -RedView.keepHeight.equal = -; Wu      -BlueView.keepLeftInset.equal = -;//left spacing from parent view is AboutBlueView.keepRightInset.equal = -;//the right distance from the parent view is $Blueview.keeptopoffsetto (redview). Equal = -;//the top distance from the Redview is -Blueview.keepheightto (redview). Equal =1;//the height and redview are equal -}

Simple automatic layout with third-party framework Keep layout

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.