NSLayout​Constraint:定义了UI属性有参照关系的两个UI元素,一个元素的frame变化时,另一个元素变化的规则;依赖依附于最近的共同父视图,包含参照元素本身。

首要:确定变化参考物;参考物的尺寸发生变化,系统会自动重新计算。

/* Create constraints explicitly.  Constraints are of the form "view1.attr1 = view2.attr2 * multiplier + constant"

If your equation does not have a second view and attribute, use nil and NSLayoutAttributeNotAnAttribute.

*/

+(instancetype)constraintWithItem:(id)view1 attribute:(NSLayoutAttribute)attr1 relatedBy:(NSLayoutRelation)relation toItem:(nullable id)view2 attribute:(NSLayoutAttribute)attr2 multiplier:(CGFloat)multiplier constant:(CGFloat)c;

A constraint defines a relationship between two user interface objects that must be satisfied by the constraint-based layout system. Each constraint is a linear equation with the following format:

Overview

item1.attribute1 = multiplier × item2.attribute2 + constant

In this equation, attribute1 and attribute2 are the variables that Auto Layout can adjust when solving these constraints. The other values are defined when you create the constraint. For example, If you’re defining the relative position of two buttons, you might say “the leading edge of the second button should be 8 points after the trailing edge of the first button.” The linear equation for this relationship is shown below:

 

最新文章

  1. Backbone源码学习之extend
  2. 深入理解ajax系列第一篇——XHR对象
  3. kendo ui简介
  4. Bash 中的环境变量
  5. my_strlen()
  6. 【编程题目】一个整数数组,长度为 n,将其分为 m 份,使各份的和相等,求 m 的最大值★★ (自己没有做出来!!)
  7. android 常见的泄漏内存方法和 leakcanary 使用方法
  8. Effective Java 62 Document all exceptions thrown by each method
  9. http://blog.csdn.net/littlechang/article/details/8642149
  10. BZOJ2295: 【POJ Challenge】我爱你啊
  11. SMART原则_百度百科
  12. Swing-JMenu菜单用法-入门
  13. SpriteBuilder中子节点的相对位置(%百分比定位)
  14. mysql You can't specify target table 'xxx' for update in FROM clause的解决
  15. xgboost 多gpu支持 编译
  16. python之路--前端CSS
  17. linux文件与目录管理笔记
  18. mysql 查看当前使用的配置文件my.cnf的方法(推荐)
  19. Python Numpy模块函数np.c_和np.r_
  20. Android ListView实现单击item出现删除按钮以及滑动出现删除按钮

热门文章

  1. C# 请求Https
  2. [PHP] PHP的脚本执行
  3. HBase入门教程
  4. IDEA使用maven建web项目示例
  5. async await的使用
  6. 移动目标在三维GIS中的实现方法
  7. Client tried to access password protected page without proper authorization (status code 401) 无法发布SceneService的解决方法
  8. Redirect local emails to a remote email account
  9. Netty高性能web框架
  10. ajax的content-download时间过慢问题的解决与思考