|
Symbol |
Replacement rule |
|
<visualFormatString> |
(<orientation>:)?(<superview><connection>)?<view>(<connection><view>)*(<connection><superview>)? |
|
<orientation> |
H|V |
|
<superview> |
| |
|
<view> |
[<viewName>(<predicateListWithParens>)?] |
|
<connection> |
e|-<predicateList>-|- |
|
<predicateList> |
<simplePredicate>|<predicateListWithParens> |
|
<simplePredicate> |
<metricName>|<positiveNumber> |
|
<predicateListWithParens> |
(<predicate>(,<predicate>)*) |
|
<predicate> |
(<relation>)?(<objectOfPredicate>)(@<priority>)? |
|
<relation> |
==|<=|>= |
|
<objectOfPredicate> |
<constant>|<viewName>(see note) |
|
<priority> |
<metricName>|<number> |
|
<constant> |
<metricName>|<number> |
|
<viewName> |
Parsed as a C identifier. This must be a key mapping to an instance ofNSViewin the passedviews dictionary. |
|
<metricName> |
Parsed as a C identifier. This must be a key mapping to an instance ofNSNumberin the passed metrics dictionary. |
|
<number> |
As parsed bystrtod_l, with the C locale. |
我们以 btn1 和btn2 为例子
[btn1]-[btn2] 这个 “-” 标准连接字符 ,表示相距标准距离,好像是 8
[btn1 (>= 10)] btn1 宽度至少为10
H:|-50 -[btn1]-30-| “H“表示水平,”|”表示父视图, 这说明 btn1 在水平方向距离父视图左边50 右边30
[btn1(==btn2)] btn1 和btn2 宽度相等
[btn1 (>= 10,<= 50)] btn1的宽度在10和50 之间
说下这个<view>
我们可以这样写
|-[btn1]-|
也可以这样
|- 50-[btn1]-|
也可以这样
|-(>=10,<=30) - [btn1 (>=30)] -(<=20)-|
本文介绍了一种用于描述用户界面布局的语言,通过符号和规则定义视图之间的位置及大小关系。详细解释了如何使用该语言来指定不同视图组件间的连接、约束条件以及它们与父视图的关系。
1256

被折叠的 条评论
为什么被折叠?



