zoukankan      html  css  js  c++  java
  • SnapKit

    SnapKit 是 Masonry 框架的团队针对 Swift 全新开发的一套自动布局框架

    代码演练

    • 使用 SnapKit 替换访客视图中的自动布局代码

    • 导入框架

    import SnapKit
    
    • 设置布局
    // 1> 图标
    iconView.snp_makeConstraints { (make) -> Void in
        make.centerX.equalTo(self.snp_centerX)
        make.centerY.equalTo(self.snp_centerY).offset(-60)
    }
    // 2> 小房子
    homeIconView.snp_makeConstraints { (make) -> Void in
        make.center.equalTo(iconView.snp_center)
    }
    // 3> 消息文字
    messageLabel.snp_makeConstraints { (make) -> Void in
        make.centerX.equalTo(iconView.snp_centerX)
        make.top.equalTo(iconView.snp_bottom).offset(16)
        make.width.equalTo(224)
        make.height.equalTo(35)
    }
    // 4> 注册按钮
    registerButton.snp_makeConstraints { (make) -> Void in
        make.left.equalTo(messageLabel.snp_left)
        make.top.equalTo(messageLabel.snp_bottom).offset(16)
        make.width.equalTo(100)
        make.height.equalTo(35)
    }
    // 5> 登录按钮
    loginButton.snp_makeConstraints { (make) -> Void in
        make.right.equalTo(messageLabel.snp_right)
        make.top.equalTo(messageLabel.snp_bottom).offset(16)
        make.width.equalTo(100)
        make.height.equalTo(35)
    }
    // 6> 遮罩视图 VFL
    maskIconView.snp_makeConstraints { (make) -> Void in
        make.left.equalTo(self.snp_left)
        make.top.equalTo(self.snp_top)
        make.right.equalTo(self.snp_right)
        make.bottom.equalTo(registerButton.snp_bottom)
    }
  • 相关阅读:
    poj 2362 Square
    poj 1011 Sticks
    hust 1062 Divisibility
    hdu 4115 Eliminate the Conflict
    Android
    android stdio 快捷键
    Android Lint的使用
    Android studio导出配置
    fragment显示 Binary XML file line #12: Error inflating class fragment 错误
    markdown 字体颜色
  • 原文地址:https://www.cnblogs.com/xufengyuan/p/7441976.html
Copyright © 2011-2022 走看看