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:

 

NSLayout​Constraint的更多相关文章

  1. 异常:java.lang.LinkageError: loader constraint violation: when resolving interface method

    异常:java.lang.LinkageError: loader constraint violation: when resolving interface method "javax. ...

  2. Constraint6:更新外键约束(Foreign Key Constraint)的引用列

    在SQL Server中,表之间存在引用关系,引用关系通过创建外键约束(Foreign Key Constraint)实现.如果一个Table中的column被其他Table引用,那么该表是参考表,或 ...

  3. Constraint2:constraint

    一,Constraint 是表定义的一部分,用于实现数据完整性. Data Integrity 由三种类型的constraint实现: Entity Integrity:数据是唯一的.约束: prim ...

  4. MySQL主从复制中断,报“Error on master: message (format)='Cannot delete or update a parent row: a foreign key constraint fails' error code=1217” 错误

    前几天,发现从库挂了,具体报错信息如下: 分析思路 1. 因为我采用的是选择性复制,只针对以下几个库进行复制: card,upay,deal,monitor,collect.所以,不太可能出现对于sa ...

  5. SQL SERVER 2005删除维护作业报错:The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id"

    案例环境: 数据库版本: Microsoft SQL Server 2005 (Microsoft SQL Server 2005 - 9.00.5000.00 (X64) ) 案例介绍: 对一个数据 ...

  6. ORA-02292: integrity constraint (xxxx) violated - child record found

    在更新表的主键字段或DELETE数据时,如果遇到ORA-02292: integrity constraint (xxxx) violated - child record found 这个是因为主外 ...

  7. Oracle约束(Constraint)详解

    概述 约束是数据库用来确保数据满足业务规则的手段,不过在真正的企业开发中,除了主键约束这类具有强需求的约束,像外键约束,检查约束更多时候仅仅出现在数据库设计阶段,真实环境却很少应用,更多是放到程序逻辑 ...

  8. ZK textbox Constraint验证

    test.zul: <?page title="" contentType="text/html;charset=UTF-8"?> <zk x ...

  9. 修复Magento SQLSTATE[23000]: Integrity constraint

    magneto在意外情况下报错Magento SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry,出现这个问题最 ...

随机推荐

  1. flash builder注释字体看不清

    window-preferences-flex-editiors-syntex coloring-ActionScript-Comment (窗口-首选项-flashbuilder-编辑器-语法着色- ...

  2. MongoDB 从入门到精通

    1,安装并启动数据库       从官网(www.mongodb.org/downloads)下载一个适合你平台的版本,我的系统是win7 64位的,下载文件也就10几M,将下载的文件解压放到任何目录 ...

  3. 十四、ReentrantLock重入锁

    一.简介 JDK提供了Lock接口来实现更丰富的锁控制,ReentrantLock即Lock接口的实现 JDK文档:http://tool.oschina.net/uploads/apidocs/jd ...

  4. JAVA基础之——Thrift原理及应用

    1 是什么 是为了解决facebook系统中各系统间大数据量的传输通信,以及系统之间语言环境不同需要跨平台的问题. 是一种实现RPC的软件框架,自定义IDL(Interface description ...

  5. springboot之内嵌tomcat修改端口号

    第一种: 在配置文件中直接修改 server.port=8089 第二种: 直接定义 TomcatEmbeddedServletContainerFactory,注册bean: @Configurat ...

  6. UVA1185 Big Number

    题目大意:求十进制下x!的位数 这题其实就是要求\(\lg\)函数值的前缀和啊 对于一个数x,若\(\lg x=y\),则其位数为\(\lfloor y+1 \rfloor\) 然后对于对数,我们有\ ...

  7. 30个优秀的chrome网页设计开发插件

    BuiltWith Resolution Test colorPicker Palette for Chrome Chrome Sniffer JS Library Detector Google F ...

  8. Teamviewer 手机端怎么使用右键-已解决

    Teamviewer 手机端怎么使用右键 可能很多人和我一样,关掉了那个提示,然后记不住操作 怎么控制电脑使用右键? 长按就可以了 拖到指定地点,然后长按不送,就会出来电脑右键菜单

  9. 通过Application存取公共数据比如登录信息等..

    Android系统在运行每一个程序应用的时候,都会创建一个Application对象,用于存储与整个应用相关的公共变量.一个Android应用只会生成一个Application对象,在不同的Activ ...

  10. Intent和BroadcastReceiver

    Intent简介 Intent是一种消息传递机制,作用: 使用类名显示启动一个特定的Service或Activity 启动Activity或Service来执行一个Intent 广播某个事件已经发生 ...