Masonry 原理与使用说明
原理:
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)参考系属性缺失补全为目标属性。
最新文章
- Java JDK配置环境变量
- MVC中html转义问题(直接输出html的方法)
- Nginx 伪静态教程
- jq select操作全集
- Linux中的文件特殊权限
- js主要知识轮廓笔记
- Gogs:可能是比Gitlab更好的选择
- 模仿《百度音乐HD》添加到下载框动画
- template method pattern
- STM32学习方法
- Loadrunner 读取文件
- 89、instancetype和id的区别
- CNN 文本分类
- nodejs async series 小白向
- AWS 使用经验
- 使用maven创建web项目【转】
- 【洛谷】【treap/堆】P2073 送花
- 响应式开发(五)-----Bootstrap CSS----------Bootstrap 网格系统
- (最小生成树)Eddy's picture -- hdu -- 1162
- 正确理解volatile与happens-before
热门文章
- C++MFC编程笔记day01 MFC介绍、创建MFC程序和重写消息处理
- Android lollipop 更新问题
- web 页面传值乱码问题
- CCBPM工作流引擎的消息机制与设计
- HDU 5371(2015多校7)-Hotaru&;#39;s problem(Manacher算法求回文串)
- YTU 2640: 编程题:运算符重载---矩阵求和
- POJ1751 Tree 树分治
- 最长回文子串问题 O(n)算法 manacher URAL1297 HDU3068
- nginx开发(一) 源码-编译
- JSP-Runoob:JSP 结构