界面布局之VFL
来源:互联网 发布:阿里云客服好做吗 编辑:程序博客网 时间:2024/05/29 08:43
VFL(Visual Format Language)
简单说明:
H 横向
V 纵向
| 父视图边缘
- 默认距离
[viewName(30)] view用[]扩住,不能有self之类的关键字(会报错,原因后续),view的宽或者高为30
- 10 - 两者间距10
[viewName(>=60@700)] view的宽或者高大于等于60(>=,==,<=),优先级为700(优先级最大为1000,数值越大越优先满足)
[view1][view2(==view1)] view1后接view2,且view2的宽或者高于view1相等
PS:view的translatesAutoresizingMaskIntoConstraints一定要设置为NO。
UINavigationBar * LHNavigation = [[UINavigationBar alloc] init]; LHNavigation.translatesAutoresizingMaskIntoConstraints = NO; UITabBar * LHTabBar = [[UITabBar alloc] init]; LHTabBar.translatesAutoresizingMaskIntoConstraints = NO; UITableView * LHTable = [[UITableView alloc] init]; LHTable.translatesAutoresizingMaskIntoConstraints = NO; //添加垂直方向的约束 NSNumber *margin = @20; //等同于 NSDictionary *mertrics = [NSDictionary dictionaryWithObjectsAndKeys:20, @"margin", nil] NSDictionaryOfVariableBindings(margin); NSDictionary *mertrics = NSDictionaryOfVariableBindings(margin); NSString *vflV = @"V:|-margin-[LHNavigation]-[LHTable]-[LHTabBar]-|"; NSDictionary * views = NSDictionaryOfVariableBindings(LHNavigation,LHTabBar,LHTable); NSArray * constraintsV = [NSLayoutConstraint constraintsWithVisualFormat:vflV options:0 metrics:mertrics views:views]; [self.view addConstraints:constraintsV] ;
阅读全文
0 0
- 界面布局之VFL
- iOS界面布局之三——纯代码的autoLayout及布局动画 iOS8及VFL语言
- ios之快速领会自动布局 VFL
- iOS学习之VFL实现自动布局
- iOS编程 界面布局 纯代码 VFL编写和添加
- IOS autoLayout之使用VFL语言进行代码自动布局
- iOS 8 Auto Layout界面自动布局系列4-使用VFL添加布局约束
- iOS 8 Auto Layout界面自动布局系列4-使用VFL添加布局约束
- Auto Layout界面自动布局系列 (使用VFL添加布局约束)
- Auto Layout界面自动布局系列-使用VFL添加布局约束
- iOS 8 Auto Layout界面自动布局系列4-使用VFL添加布局约束
- iOS 8 Auto Layout界面自动布局系列4-使用VFL添加布局约束
- iOS 8 Auto Layout界面自动布局系列4-使用VFL添加布局约束
- iOS 8 Auto Layout界面自动布局系列4-使用VFL添加布局约束
- iOS 自动布局 VFL
- VFL 自动布局
- VFL-自动布局
- iOS编程 界面布局 纯代码 VFL编写和添加 上下两个view
- 可下拉输入框
- python3字符串编码
- 端午假期
- js 实现在移动端开发,解决不同手机像素大小的兼容问题
- ssh学习之hibernate篇
- 界面布局之VFL
- 利用fl2440开发板和rt3070模块实现简单路由器制作
- node-red端口争用问题
- 《Core Java》 读书笔记——第3章
- OpenGL蓝宝书源码学习(七)第四章——ModelViewProjection.cpp
- 螺旋数组
- oracle数据库存储过程创建
- 每次读取一行字符串输入
- vcruntime140.dll问题的解决