-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathExampleVC1.m
More file actions
88 lines (70 loc) · 2.51 KB
/
ExampleVC1.m
File metadata and controls
88 lines (70 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// ExampleVC1.m
// JCFrameLayout
//
// Created by abc on 17/3/31.
// Copyright © 2017年 jackcat. All rights reserved.
//
#import "ExampleVC1.h"
#import "JCFrameLayout.h"
#define radomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1]
@interface ExampleVC1 ()
@end
@implementation ExampleVC1
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
UIView *leftView = [[UIView alloc]init];
leftView.backgroundColor = radomColor;
[self.view addSubview:leftView];
leftView.jc_debug_key = @"leftView";
[leftView jc_makeLayout:^(JCFrameMake *make) {
make.width.jc_equalTo(50);
make.top.jc_equalTo(50 + 64);
make.bottom.jc_equalTo(-50);
make.left.jc_equalTo(0);
}];
UIView *rightView = [[UIView alloc]init];
rightView.backgroundColor = radomColor;
[self.view addSubview:rightView];
rightView.jc_debug_key = @"rightView";
[rightView jc_makeLayout:^(JCFrameMake *make) {
make.width.jc_equalTo(50);
make.top.jc_equalTo(50 + 64);
make.bottom.jc_equalTo(-50);
make.right.jc_equalTo(0);
}];
UIView *topView = [[UIView alloc]init];
topView.backgroundColor = radomColor;
[self.view addSubview:topView];
topView.jc_debug_key = @"topView";
[topView jc_makeLayout:^(JCFrameMake *make) {
make.top.jc_equalTo(64);
make.height.jc_equalTo(50);
make.left.jc_equalTo(50);
make.right.jc_equalTo(-50);
}];
UIView *bottomView = [[UIView alloc]init];
bottomView.backgroundColor = radomColor;
[self.view addSubview:bottomView];
bottomView.jc_debug_key = @"bottomView";
[bottomView jc_makeLayout:^(JCFrameMake *make) {
make.height.jc_equalTo(50);
make.left.jc_equalTo(50);
make.right.jc_equalTo(-50);
make.bottom.jc_equalTo(0);
}];
UIView *centerView = [[UIView alloc]init];
centerView.backgroundColor = radomColor;
[self.view addSubview:centerView];
centerView.jc_debug_key = @"centerView";
[centerView jc_makeLayout:^(JCFrameMake *make) {
make.left.equalTo(leftView.jc_right);
make.top.equalTo(topView.jc_bottom);
make.right.equalTo(rightView.jc_left);
make.bottom.equalTo(bottomView.jc_top);
}];
NSLog(@"centerView.frame = %@",[NSValue valueWithCGRect:centerView.frame]);
[self.view sendSubviewToBack:centerView];
}
@end