AutoLayout(四)
来源:互联网 发布:你有毒网络用语 编辑:程序博客网 时间:2024/05/16 04:37
可视化约束 Visual format language(VFL)
如下: [self.view addConstraint:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[view1]-8-[view2]" options:NSLayoutFormatAlignAllLeading metrics:nil views:NSDictionaryOfVariableBindings(view1,view2)]]; 解释:创建由view1和view2组成的左对齐的一列,在它们之间保留8点间隔 需要注意的是: V:[view1]-8-[view2] 此表达式如何解释? NSLayoutFormatAlignAllLeading ?为什么是这个枚举类型? 1. VFL 语法介绍(和NSLayoutFormatOptions搭配使用)水平或垂直放置 H: / V: V:[View1]-5-[View2] 将View2放到其顶部距离View1底部15点位置 视图 [item] [view1] 父视图 | H:|[view1] 使view1的宽度尺寸同父视图的一致 关系 == / <= / >= H:[view1]-(>=20)-[view2] 使view2的前缘距离view1后缘至少20点像素 度量 metric H:[view1(<=someWidth)]V:[view1]-mySpacing-[view2] 度量是键,someWidth和mySpacing必须在传递的度量字典中映射为NSNumber值 齐平对齐 [item][item] H:[view1][view2] 使View1的后缘和view2的前缘齐平 固定间隔 [item]-gap-[item] gap为间隔的数值 V:[view1]-20-[view2] 灵活间隔 [item]-(>=someValue)-[item] 根据需要,视图可以隔离,最少someValue的像素 固定高度和宽度 [item(size)] [view1(100)] 最小宽度/高度和最大宽度/高度 [item(>=size)] [view1(>=50)] 同另一个视图匹配高度/宽度 [item(==item)]/[item(<=item)]/[item(>=item)] [view1(==view2)] :使view沿着某个坐标轴的尺寸和view2一样 和父视图对齐 |[item] V:|[view1] 相对于父视图的inset |-[item] 相对于父视图的自定义inset |-gap-[item] H:|-15-[view1] 优先级: @value (value 从 0 到 1000) [view1(<=50@20)] 2. 选项 枚举类型 NSLayoutFormatOptions 对齐掩码: NSLayoutFormatAlignAllTrailing NSLayoutFormatAlignAllLeading NSLayoutFormatAlignAllTop NSLayoutFormatAlignAllBottom NSLayoutFormatAlignAllRight NSLayoutFormatAlignAllLeft NSLayoutFormatAlignAllBaseline NSLayoutFormatAlignAllCenterY NSLayoutFormatAlignAllCenterX 格式方向 NSLayoutFormatDirectionRightToLeft NSLayoutFormatDirectionLeftToRight NSLayoutFormatDirectionLeadingToTrailing 待续... 请关注微博 ID: 枫一般低调
视频教程地址:http://v.youku.com/v_show/id_XMTI3NzE2ODQ5Ng==.html?f=25891909&from=y1.7-1.3
0 0
- AutoLayout(四)
- IOS6之AutoLayout(四)
- IOS6之AutoLayout(四)
- IOS6之AutoLayout(四)
- iOS Core Animation详解(四)AutoLayout中的动画
- AutoLayout(自动布局)
- AutoLayout(二)
- Autolayout(自动布局)
- Autolayout (一)
- AutoLayout(二)
- AutoLayout(三)
- autolayout入门(一)
- autolayout 入门(二)
- Autolayout
- autolayout
- AutoLayout
- autolayout
- AutoLayout
- Spark源码系列(一)spark-submit提交作业过程
- C++ char*,const char*,string的相互转换
- Win7(64位)安装Microsoft SQL Server Management Studio Express[error 29506]
- RGB颜色对照表
- 无边框窗体拖动
- AutoLayout(四)
- Codeforces 558C - Amr and Chemistry (枚举)
- 报错 You need to use a Theme.AppCompat theme (or descendant) with this activity.
- 黑马程序员_Objective-C语言_封装(汇总)
- 关于Ubuntu不启动X,直接进入字符界面
- Java基础之集合
- 使用jQuery开发一个带有密码强度检验的超酷注册页面
- Android中Activity四种启动模式和taskAffinity属性详解
- DNN报错:The compiler failed with error code 1.