iOS visual format
来源:互联网 发布:mac app store更改用户 编辑:程序博客网 时间:2024/05/01 00:52
autoLayout的学习资源实在太少,下面是我个人这一段时间对autoLayout学习的总结。
cocoa & cocoa touch 有三种方式创建自动布局:xib || storyBoard、使用代码创建单个约束、使用visual format创建约束.
关于三种方式的比较,可以在internet找到答案。官方指出的visual format 语法如下表格:
Symbol
Replacement rule
<visualFormatString>
(<orientation>:)?(<superview><connection>)?<view>(<connection><view>)*(<connection><superview>)?
<orientation>
H|V (H->表示水平方向,V->表示垂直方向)
<superview>
|(这条竖线代表当前视图的父视图)
<view>
[<viewName>(<predicateListWithParens>)?]例:[someView(someViewWidth)]
<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
上面的表格 你也许看的不太懂,要多读多写几个例子,自然而然就明白了。
下面是官方使用visual format的几个简单例子
The following are examples of constraints you can specify using the visual format. Note how the text visually matches the image.
- Standard Space
[button]-[textField]
- Width Constraint
[button(>=50)]
- Connection to Superview
|-50-[purpleBox]-50-|
- Vertical Layout
V:[topField]-10-[bottomField]
- Flush Views
[maroonView][blueView]
- Priority
[button(100@20)]
- Equal Widths
[button1(==button2)]
- Multiple Predicates
[flexibleButton(>=70,<=100)]
- A Complete Line of Layout
|-[find]-[findNext]-[findField(>=20)]-|
本人写的一个例子,地址:https://github.com/shiyingyan/autoLayout-visualFormat
- iOS visual format
- iOS 6 Auto Layout Visual Format Language
- iOS: 布局可视化语法 Visual Format Syntax
- iOS Visual format language(VFL)
- iOS—Visual Format Language语法的简单学习
- iOS布局格式语言(Visual Format Language)
- Visual Format String Grammar
- visual format string
- VFL:Visual format language
- iOS学习笔记04——Visual Format Language语法的简单学习
- IOS布局笔记二( Visual Format Language 定义水平和垂直约束)
- iOS学习笔记04——Visual Format Language语法的简单学习
- iOS学习笔记04——Visual Format Language语法的简单学习
- iOS之使用代码实现autolayout中Visual format language(三)
- iOS开发笔记--使用Auto Layout中的VFL(Visual format language)--代码实现自动布局
- iOS自动布局(二)--代码控制--Visual Format language(可视化格式语言)
- iOS学习——Visual Format Language语法的简单学习
- iOS开发笔记--使用Auto Layout中的VFL(Visual format language)--代码实现自动布局
- jQuery扁平化设计下拉菜单插件
- android activitygroup中edittext文本无法删除
- RowSet与ResultSet的区别
- 错误处理,错误输出
- 蓝桥杯训练题
- iOS visual format
- Android4.0的Alertdialog对话框,设置点击其他位置不消失
- 【升级篇】JBPM4.4过渡到Activiti
- VS2010修改菜单字体
- SRM 633 DIV2 A
- Android使用工具方法-检测服务是否正在运行
- Eclipse上GIT插件EGIT使用手册
- (三十四)NavigationController初步
- ArcGIS教程:什么是地统计?