SnapKit

GitHub地址:https://github.com/SnapKit/SnapKit
中文说明:http://www.hangge.com/blog/cache/detail_1097.html

  • 例子
        let redView = UIView()
        redView.backgroundColor = UIColor.red
        self.view.addSubview(redView)
        redView.snp.makeConstraints { (make) in
            make.width.height.equalTo(50)
            make.center.equalTo(self.view)
        }
  • SnapKit设置百分百
   //宽度为父view的宽度的一半
    make.width.equalTo(_containerView.mas_width).multipliedBy(0.5);

你可能感兴趣的:(SnapKit)