原理:

1)约束生成;MASConstraintMaker;

2)缺省补齐:

- (void)setSecondViewAttribute:(id)secondViewAttribute {

if ([secondViewAttribute isKindOfClass:NSValue.class]) {

[self setLayoutConstantWithValue:secondViewAttribute];

} else if ([secondViewAttribute isKindOfClass:MAS_VIEW.class]) {

_secondViewAttribute = [[MASViewAttribute alloc] initWithView:secondViewAttribute layoutAttribute:self.firstViewAttribute.layoutAttribute];

} else if ([secondViewAttribute isKindOfClass:MASViewAttribute.class]) {

_secondViewAttribute = secondViewAttribute;

} else {

NSAssert(NO, @"attempting to add unsupported attribute: %@", secondViewAttribute);

}

}

3)寻找约束添加视图,并添加

if (self.secondViewAttribute.view) {

MAS_VIEW *closestCommonSuperview = [self.firstViewAttribute.view mas_closestCommonSuperview:self.secondViewAttribute.view];

NSAssert(closestCommonSuperview,

@"couldn't find a common superview for %@ and %@",

self.firstViewAttribute.view, self.secondViewAttribute.view);

self.installedView = closestCommonSuperview;

} else if (self.firstViewAttribute.isSizeAttribute) {

self.installedView = self.firstViewAttribute.view;

} else {

self.installedView = self.firstViewAttribute.view.superview;

}

4)

(1)绝对尺寸信息添加到自身;

(2)绝对布局数据添加到父视图;

(3)参考系属性缺失补全为目标属性。

最新文章

  1. Java JDK配置环境变量
  2. MVC中html转义问题(直接输出html的方法)
  3. Nginx 伪静态教程
  4. jq select操作全集
  5. Linux中的文件特殊权限
  6. js主要知识轮廓笔记
  7. Gogs:可能是比Gitlab更好的选择
  8. 模仿《百度音乐HD》添加到下载框动画
  9. template method pattern
  10. STM32学习方法
  11. Loadrunner 读取文件
  12. 89、instancetype和id的区别
  13. CNN 文本分类
  14. nodejs async series 小白向
  15. AWS 使用经验
  16. 使用maven创建web项目【转】
  17. 【洛谷】【treap/堆】P2073 送花
  18. 响应式开发(五)-----Bootstrap CSS----------Bootstrap 网格系统
  19. (最小生成树)Eddy's picture -- hdu -- 1162
  20. 正确理解volatile与happens-before

热门文章

  1. C++MFC编程笔记day01 MFC介绍、创建MFC程序和重写消息处理
  2. Android lollipop 更新问题
  3. web 页面传值乱码问题
  4. CCBPM工作流引擎的消息机制与设计
  5. HDU 5371(2015多校7)-Hotaru's problem(Manacher算法求回文串)
  6. YTU 2640: 编程题:运算符重载---矩阵求和
  7. POJ1751 Tree 树分治
  8. 最长回文子串问题 O(n)算法 manacher URAL1297 HDU3068
  9. nginx开发(一) 源码-编译
  10. JSP-Runoob:JSP 结构