iOS编程 界面布局 纯代码 VFL编写和添加
2015-07-10 09:36
471 查看
vfl ---visual formmatting language---可视化格式语言纯代码的编码
V:|-20-[view(80)]-20-| V(垂直方向)距离上边边20,高度80,下边边20
H:|-20-[view(80)]-20-| H(水平方向)距离左边边20,宽度80,右边边20
//
// ViewController.m
// vfl-0710
//
// Created by tianshangrenjian on 15/7/10.
// Copyright © 2015年 tianshangrenjian. All rights reserved.
//
#import "ViewController.h"
@interface
ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super
viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIView *view=[[UIView
alloc] init];
view.backgroundColor=[UIColor
blueColor];
[self.view
addSubview:view];
//
view.translatesAutoresizingMaskIntoConstraints=NO;
NSArray *arrH=[NSLayoutConstraint
constraintsWithVisualFormat:@"H:|-20-[view]-20-|"
options:0
metrics:nil
views:@{@"view":view}];
NSArray *arrV=[NSLayoutConstraint
constraintsWithVisualFormat:@"V:[view(80)]-20-|"
options:0
metrics:nil
views:@{@"view":view}];
[self.view
addConstraints:arrH];
[self.view
addConstraints:arrV];
}
- (void)didReceiveMemoryWarning {
[super
didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
V:|-20-[view(80)]-20-| V(垂直方向)距离上边边20,高度80,下边边20
H:|-20-[view(80)]-20-| H(水平方向)距离左边边20,宽度80,右边边20
//
// ViewController.m
// vfl-0710
//
// Created by tianshangrenjian on 15/7/10.
// Copyright © 2015年 tianshangrenjian. All rights reserved.
//
#import "ViewController.h"
@interface
ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super
viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIView *view=[[UIView
alloc] init];
view.backgroundColor=[UIColor
blueColor];
[self.view
addSubview:view];
//
view.translatesAutoresizingMaskIntoConstraints=NO;
NSArray *arrH=[NSLayoutConstraint
constraintsWithVisualFormat:@"H:|-20-[view]-20-|"
options:0
metrics:nil
views:@{@"view":view}];
NSArray *arrV=[NSLayoutConstraint
constraintsWithVisualFormat:@"V:[view(80)]-20-|"
options:0
metrics:nil
views:@{@"view":view}];
[self.view
addConstraints:arrH];
[self.view
addConstraints:arrV];
}
- (void)didReceiveMemoryWarning {
[super
didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
相关文章推荐
- iOS 8 模拟器上设置中文输入
- IOS下获取时间、手机系统时区以及获取时间间隔
- IOS图片压缩上传服务器终极解决方案
- ld: -pie can only be used when targeting iOS 4.2 or later clang: error: linker command failed with e
- iOS开发 替换NSLog打印设置
- ld: -pie can only be used when targeting iOS 4.2 or later clang: error: linker command failed with e
- iOS开发之控件ContentMode代码改变填充模式小结
- IOS多线程基本使用
- IOS design patterns
- ios 判断是qq,银行卡,手机号等等公用的方法
- iOS多工程协同开发
- iOS中MRC和ARC混编
- iOS基础(c)—指针
- 汉语字典或者词典的简单的ios小demo
- iOS 多线程技术由浅深入(学习笔记)
- 苹果开发 笔记(46)圆角
- iOS 开发怎么入门?2
- iOS 开发中 SIGPIPE信号的分析跟处理
- iOS 的本地化使用和创建过程
- 小白学开发(ios)基础C_函数(2015-07-09)