NSLayoutConstraint
NSLayoutConstraint:定义了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:
最新文章
- Backbone源码学习之extend
- 深入理解ajax系列第一篇——XHR对象
- kendo ui简介
- Bash 中的环境变量
- my_strlen()
- 【编程题目】一个整数数组,长度为 n,将其分为 m 份,使各份的和相等,求 m 的最大值★★ (自己没有做出来!!)
- android 常见的泄漏内存方法和 leakcanary 使用方法
- Effective Java 62 Document all exceptions thrown by each method
- http://blog.csdn.net/littlechang/article/details/8642149
- BZOJ2295: 【POJ Challenge】我爱你啊
- SMART原则_百度百科
- Swing-JMenu菜单用法-入门
- SpriteBuilder中子节点的相对位置(%百分比定位)
- mysql You can't specify target table 'xxx' for update in FROM clause的解决
- xgboost 多gpu支持 编译
- python之路--前端CSS
- linux文件与目录管理笔记
- mysql 查看当前使用的配置文件my.cnf的方法(推荐)
- Python Numpy模块函数np.c_和np.r_
- Android ListView实现单击item出现删除按钮以及滑动出现删除按钮
热门文章
- C# 请求Https
- [PHP] PHP的脚本执行
- HBase入门教程
- IDEA使用maven建web项目示例
- async await的使用
- 移动目标在三维GIS中的实现方法
- Client tried to access password protected page without proper authorization (status code 401) 无法发布SceneService的解决方法
- Redirect local emails to a remote email account
- Netty高性能web框架
- ajax的content-download时间过慢问题的解决与思考