Code Monkey home page Code Monkey logo

jdlayout's Introduction

JDAutoLayout

超简易的约束布局

demo png

跟其他约束库对比有以下几点优势

一、更容易更新现有的约束

    可以简单的更新xib里面的约束,也可以更新其他途径增加的约束,而不需要xib拉一根约束线或者代码持有约束属性!
    
    self.button2.jd_left(self.button1).jd_equal(100).jd_update();

二、提供垂直平分 、水平平分等简易方法

    //垂直等高
    self.view1.jd_equalHeightSubViews(@[label1,label2]);
    
    //水平等宽
    self.view2.jd_equalWidthSubViews(@[label1,label21]);
    
    //还有对父View简易使用
    self.view2.jd_leftToSuperView().jd_equal(10).jd_layout();
    
    //对frame、insets、size的封装
    self.view2.jd_insets(UIEdgeInsetsZero).jd_equal(10).jd_layout();
    

三、支持OC、swift调用,减少项目中约束库(比如Masonry、SnapKit)的引用

     //swift封装的布局类
     self.view1 = UIView.init()
     
     self.view1.backgroundColor = UIColor.red
     
     self.view.addSubview(self.view1)
     
     self.view1.jd_frame(CGRect(x: 50, y: 300, width: 100, height: 100)).jd_layout()
     

四、链式调用

可以用链式的方式一直调用下去!!!

五、布局可以分步实现

比如先初始化的时候布局左右以及高,等网络请求完在布局top!!!

cocoapods使用

   pod 'JDAutoLayout', '~> 1.1.7'

jdlayout's People

Contributors

jdongkhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.