Merge pull request #191 from xserver/master
example variable rename.
Showing
5 changed files
with
139 additions
and
139 deletions
@@ -22,23 +22,23 @@ | @@ -22,23 +22,23 @@ | ||
22 | self = [super init]; | 22 | self = [super init]; |
23 | if (!self) return nil; | 23 | if (!self) return nil; |
24 | 24 | ||
25 | - UIView *view1 = UIView.new; | ||
26 | - view1.backgroundColor = UIColor.greenColor; | ||
27 | - view1.layer.borderColor = UIColor.blackColor.CGColor; | ||
28 | - view1.layer.borderWidth = 2; | ||
29 | - [self addSubview:view1]; | ||
30 | - | ||
31 | - UIView *view2 = UIView.new; | ||
32 | - view2.backgroundColor = UIColor.redColor; | ||
33 | - view2.layer.borderColor = UIColor.blackColor.CGColor; | ||
34 | - view2.layer.borderWidth = 2; | ||
35 | - [self addSubview:view2]; | ||
36 | - | ||
37 | - UIView *view3 = UIView.new; | ||
38 | - view3.backgroundColor = UIColor.blueColor; | ||
39 | - view3.layer.borderColor = UIColor.blackColor.CGColor; | ||
40 | - view3.layer.borderWidth = 2; | ||
41 | - [self addSubview:view3]; | 25 | + UIView *greenView = UIView.new; |
26 | + greenView.backgroundColor = UIColor.greenColor; | ||
27 | + greenView.layer.borderColor = UIColor.blackColor.CGColor; | ||
28 | + greenView.layer.borderWidth = 2; | ||
29 | + [self addSubview:greenView]; | ||
30 | + | ||
31 | + UIView *redView = UIView.new; | ||
32 | + redView.backgroundColor = UIColor.redColor; | ||
33 | + redView.layer.borderColor = UIColor.blackColor.CGColor; | ||
34 | + redView.layer.borderWidth = 2; | ||
35 | + [self addSubview:redView]; | ||
36 | + | ||
37 | + UIView *blueView = UIView.new; | ||
38 | + blueView.backgroundColor = UIColor.blueColor; | ||
39 | + blueView.layer.borderColor = UIColor.blackColor.CGColor; | ||
40 | + blueView.layer.borderWidth = 2; | ||
41 | + [self addSubview:blueView]; | ||
42 | 42 | ||
43 | UIView *superview = self; | 43 | UIView *superview = self; |
44 | int padding = self.padding = 10; | 44 | int padding = self.padding = 10; |
@@ -46,34 +46,34 @@ | @@ -46,34 +46,34 @@ | ||
46 | 46 | ||
47 | self.animatableConstraints = NSMutableArray.new; | 47 | self.animatableConstraints = NSMutableArray.new; |
48 | 48 | ||
49 | - [view1 mas_makeConstraints:^(MASConstraintMaker *make) { | 49 | + [greenView mas_makeConstraints:^(MASConstraintMaker *make) { |
50 | [self.animatableConstraints addObjectsFromArray:@[ | 50 | [self.animatableConstraints addObjectsFromArray:@[ |
51 | make.edges.equalTo(superview).insets(paddingInsets).priorityLow(), | 51 | make.edges.equalTo(superview).insets(paddingInsets).priorityLow(), |
52 | - make.bottom.equalTo(view3.mas_top).offset(-padding), | 52 | + make.bottom.equalTo(blueView.mas_top).offset(-padding), |
53 | ]]; | 53 | ]]; |
54 | 54 | ||
55 | - make.size.equalTo(view2); | ||
56 | - make.height.equalTo(view3.mas_height); | 55 | + make.size.equalTo(redView); |
56 | + make.height.equalTo(blueView.mas_height); | ||
57 | }]; | 57 | }]; |
58 | 58 | ||
59 | - [view2 mas_makeConstraints:^(MASConstraintMaker *make) { | 59 | + [redView mas_makeConstraints:^(MASConstraintMaker *make) { |
60 | [self.animatableConstraints addObjectsFromArray:@[ | 60 | [self.animatableConstraints addObjectsFromArray:@[ |
61 | make.edges.equalTo(superview).insets(paddingInsets).priorityLow(), | 61 | make.edges.equalTo(superview).insets(paddingInsets).priorityLow(), |
62 | - make.left.equalTo(view1.mas_right).offset(padding), | ||
63 | - make.bottom.equalTo(view3.mas_top).offset(-padding), | 62 | + make.left.equalTo(greenView.mas_right).offset(padding), |
63 | + make.bottom.equalTo(blueView.mas_top).offset(-padding), | ||
64 | ]]; | 64 | ]]; |
65 | 65 | ||
66 | - make.size.equalTo(view1); | ||
67 | - make.height.equalTo(view3.mas_height); | 66 | + make.size.equalTo(greenView); |
67 | + make.height.equalTo(blueView.mas_height); | ||
68 | }]; | 68 | }]; |
69 | 69 | ||
70 | - [view3 mas_makeConstraints:^(MASConstraintMaker *make) { | 70 | + [blueView mas_makeConstraints:^(MASConstraintMaker *make) { |
71 | [self.animatableConstraints addObjectsFromArray:@[ | 71 | [self.animatableConstraints addObjectsFromArray:@[ |
72 | make.edges.equalTo(superview).insets(paddingInsets).priorityLow(), | 72 | make.edges.equalTo(superview).insets(paddingInsets).priorityLow(), |
73 | ]]; | 73 | ]]; |
74 | 74 | ||
75 | - make.height.equalTo(view1.mas_height); | ||
76 | - make.height.equalTo(view2.mas_height); | 75 | + make.height.equalTo(greenView.mas_height); |
76 | + make.height.equalTo(redView.mas_height); | ||
77 | }]; | 77 | }]; |
78 | 78 | ||
79 | return self; | 79 | return self; |
@@ -14,29 +14,29 @@ | @@ -14,29 +14,29 @@ | ||
14 | self = [super init]; | 14 | self = [super init]; |
15 | if (!self) return nil; | 15 | if (!self) return nil; |
16 | 16 | ||
17 | - UIView *view1 = UIView.new; | ||
18 | - view1.backgroundColor = UIColor.greenColor; | ||
19 | - view1.layer.borderColor = UIColor.blackColor.CGColor; | ||
20 | - view1.layer.borderWidth = 2; | ||
21 | - [self addSubview:view1]; | ||
22 | - | ||
23 | - UIView *view2 = UIView.new; | ||
24 | - view2.backgroundColor = UIColor.redColor; | ||
25 | - view2.layer.borderColor = UIColor.blackColor.CGColor; | ||
26 | - view2.layer.borderWidth = 2; | ||
27 | - [self addSubview:view2]; | ||
28 | - | ||
29 | - UIView *view3 = UIView.new; | ||
30 | - view3.backgroundColor = UIColor.blueColor; | ||
31 | - view3.layer.borderColor = UIColor.blackColor.CGColor; | ||
32 | - view3.layer.borderWidth = 2; | ||
33 | - [self addSubview:view3]; | 17 | + UIView *greenView = UIView.new; |
18 | + greenView.backgroundColor = UIColor.greenColor; | ||
19 | + greenView.layer.borderColor = UIColor.blackColor.CGColor; | ||
20 | + greenView.layer.borderWidth = 2; | ||
21 | + [self addSubview:greenView]; | ||
22 | + | ||
23 | + UIView *redView = UIView.new; | ||
24 | + redView.backgroundColor = UIColor.redColor; | ||
25 | + redView.layer.borderColor = UIColor.blackColor.CGColor; | ||
26 | + redView.layer.borderWidth = 2; | ||
27 | + [self addSubview:redView]; | ||
28 | + | ||
29 | + UIView *blueView = UIView.new; | ||
30 | + blueView.backgroundColor = UIColor.blueColor; | ||
31 | + blueView.layer.borderColor = UIColor.blackColor.CGColor; | ||
32 | + blueView.layer.borderWidth = 2; | ||
33 | + [self addSubview:blueView]; | ||
34 | 34 | ||
35 | UIView *superview = self; | 35 | UIView *superview = self; |
36 | UIEdgeInsets padding = UIEdgeInsetsMake(15, 10, 15, 10); | 36 | UIEdgeInsets padding = UIEdgeInsetsMake(15, 10, 15, 10); |
37 | 37 | ||
38 | 38 | ||
39 | - [view1 mas_makeConstraints:^(MASConstraintMaker *make) { | 39 | + [greenView mas_makeConstraints:^(MASConstraintMaker *make) { |
40 | // chain attributes | 40 | // chain attributes |
41 | make.top.and.left.equalTo(superview).insets(padding); | 41 | make.top.and.left.equalTo(superview).insets(padding); |
42 | 42 | ||
@@ -44,31 +44,31 @@ | @@ -44,31 +44,31 @@ | ||
44 | // make.top.greaterThanOrEqualTo(superview).insets(padding); | 44 | // make.top.greaterThanOrEqualTo(superview).insets(padding); |
45 | // make.left.greaterThanOrEqualTo(superview).insets(padding); | 45 | // make.left.greaterThanOrEqualTo(superview).insets(padding); |
46 | 46 | ||
47 | - make.bottom.equalTo(view3.mas_top).insets(padding); | ||
48 | - make.right.equalTo(view2.mas_left).insets(padding); | ||
49 | - make.width.equalTo(view2.mas_width); | 47 | + make.bottom.equalTo(blueView.mas_top).insets(padding); |
48 | + make.right.equalTo(redView.mas_left).insets(padding); | ||
49 | + make.width.equalTo(redView.mas_width); | ||
50 | 50 | ||
51 | - make.height.equalTo(@[view2, view3]); | 51 | + make.height.equalTo(@[redView, blueView]); |
52 | }]; | 52 | }]; |
53 | 53 | ||
54 | - [view2 mas_makeConstraints:^(MASConstraintMaker *make) { | 54 | + [redView mas_makeConstraints:^(MASConstraintMaker *make) { |
55 | // chain attributes | 55 | // chain attributes |
56 | make.top.and.right.equalTo(superview).insets(padding); | 56 | make.top.and.right.equalTo(superview).insets(padding); |
57 | 57 | ||
58 | - make.left.equalTo(view1.mas_right).insets(padding); | ||
59 | - make.bottom.equalTo(view3.mas_top).insets(padding); | ||
60 | - make.width.equalTo(view1.mas_width); | 58 | + make.left.equalTo(greenView.mas_right).insets(padding); |
59 | + make.bottom.equalTo(blueView.mas_top).insets(padding); | ||
60 | + make.width.equalTo(greenView.mas_width); | ||
61 | 61 | ||
62 | - make.height.equalTo(@[view1, view3]); | 62 | + make.height.equalTo(@[greenView, blueView]); |
63 | }]; | 63 | }]; |
64 | 64 | ||
65 | - [view3 mas_makeConstraints:^(MASConstraintMaker *make) { | ||
66 | - make.top.equalTo(view1.mas_bottom).insets(padding); | 65 | + [blueView mas_makeConstraints:^(MASConstraintMaker *make) { |
66 | + make.top.equalTo(greenView.mas_bottom).insets(padding); | ||
67 | 67 | ||
68 | // chain attributes | 68 | // chain attributes |
69 | make.left.right.and.bottom.equalTo(superview).insets(padding); | 69 | make.left.right.and.bottom.equalTo(superview).insets(padding); |
70 | 70 | ||
71 | - make.height.equalTo(@[view1, view2]); | 71 | + make.height.equalTo(@[greenView, redView]); |
72 | }]; | 72 | }]; |
73 | 73 | ||
74 | return self; | 74 | return self; |
@@ -14,57 +14,57 @@ | @@ -14,57 +14,57 @@ | ||
14 | self = [super init]; | 14 | self = [super init]; |
15 | if (!self) return nil; | 15 | if (!self) return nil; |
16 | 16 | ||
17 | - UIView *view1 = UIView.new; | ||
18 | - view1.backgroundColor = UIColor.greenColor; | ||
19 | - view1.layer.borderColor = UIColor.blackColor.CGColor; | ||
20 | - view1.layer.borderWidth = 2; | ||
21 | - [self addSubview:view1]; | 17 | + UIView *greenView = UIView.new; |
18 | + greenView.backgroundColor = UIColor.greenColor; | ||
19 | + greenView.layer.borderColor = UIColor.blackColor.CGColor; | ||
20 | + greenView.layer.borderWidth = 2; | ||
21 | + [self addSubview:greenView]; | ||
22 | 22 | ||
23 | - UIView *view2 = UIView.new; | ||
24 | - view2.backgroundColor = UIColor.redColor; | ||
25 | - view2.layer.borderColor = UIColor.blackColor.CGColor; | ||
26 | - view2.layer.borderWidth = 2; | ||
27 | - [self addSubview:view2]; | 23 | + UIView *redView = UIView.new; |
24 | + redView.backgroundColor = UIColor.redColor; | ||
25 | + redView.layer.borderColor = UIColor.blackColor.CGColor; | ||
26 | + redView.layer.borderWidth = 2; | ||
27 | + [self addSubview:redView]; | ||
28 | 28 | ||
29 | - UIView *view3 = UIView.new; | ||
30 | - view3.backgroundColor = UIColor.blueColor; | ||
31 | - view3.layer.borderColor = UIColor.blackColor.CGColor; | ||
32 | - view3.layer.borderWidth = 2; | ||
33 | - [self addSubview:view3]; | 29 | + UIView *blueView = UIView.new; |
30 | + blueView.backgroundColor = UIColor.blueColor; | ||
31 | + blueView.layer.borderColor = UIColor.blackColor.CGColor; | ||
32 | + blueView.layer.borderWidth = 2; | ||
33 | + [self addSubview:blueView]; | ||
34 | 34 | ||
35 | UIView *superview = self; | 35 | UIView *superview = self; |
36 | int padding = 10; | 36 | int padding = 10; |
37 | 37 | ||
38 | //if you want to use Masonry without the mas_ prefix | 38 | //if you want to use Masonry without the mas_ prefix |
39 | //define MAS_SHORTHAND before importing Masonry.h see Masonry iOS Examples-Prefix.pch | 39 | //define MAS_SHORTHAND before importing Masonry.h see Masonry iOS Examples-Prefix.pch |
40 | - [view1 makeConstraints:^(MASConstraintMaker *make) { | 40 | + [greenView makeConstraints:^(MASConstraintMaker *make) { |
41 | make.top.greaterThanOrEqualTo(superview.top).offset(padding); | 41 | make.top.greaterThanOrEqualTo(superview.top).offset(padding); |
42 | make.left.equalTo(superview.left).offset(padding); | 42 | make.left.equalTo(superview.left).offset(padding); |
43 | - make.bottom.equalTo(view3.top).offset(-padding); | ||
44 | - make.right.equalTo(view2.left).offset(-padding); | ||
45 | - make.width.equalTo(view2.width); | 43 | + make.bottom.equalTo(blueView.top).offset(-padding); |
44 | + make.right.equalTo(redView.left).offset(-padding); | ||
45 | + make.width.equalTo(redView.width); | ||
46 | 46 | ||
47 | - make.height.equalTo(view2.height); | ||
48 | - make.height.equalTo(view3.height); | 47 | + make.height.equalTo(redView.height); |
48 | + make.height.equalTo(blueView.height); | ||
49 | }]; | 49 | }]; |
50 | 50 | ||
51 | //with is semantic and option | 51 | //with is semantic and option |
52 | - [view2 mas_makeConstraints:^(MASConstraintMaker *make) { | 52 | + [redView mas_makeConstraints:^(MASConstraintMaker *make) { |
53 | make.top.equalTo(superview.mas_top).with.offset(padding); //with with | 53 | make.top.equalTo(superview.mas_top).with.offset(padding); //with with |
54 | - make.left.equalTo(view1.mas_right).offset(padding); //without with | ||
55 | - make.bottom.equalTo(view3.mas_top).offset(-padding); | 54 | + make.left.equalTo(greenView.mas_right).offset(padding); //without with |
55 | + make.bottom.equalTo(blueView.mas_top).offset(-padding); | ||
56 | make.right.equalTo(superview.mas_right).offset(-padding); | 56 | make.right.equalTo(superview.mas_right).offset(-padding); |
57 | - make.width.equalTo(view1.mas_width); | 57 | + make.width.equalTo(greenView.mas_width); |
58 | 58 | ||
59 | - make.height.equalTo(@[view1, view3]); //can pass array of views | 59 | + make.height.equalTo(@[greenView, blueView]); //can pass array of views |
60 | }]; | 60 | }]; |
61 | 61 | ||
62 | - [view3 mas_makeConstraints:^(MASConstraintMaker *make) { | ||
63 | - make.top.equalTo(view1.mas_bottom).offset(padding); | 62 | + [blueView mas_makeConstraints:^(MASConstraintMaker *make) { |
63 | + make.top.equalTo(greenView.mas_bottom).offset(padding); | ||
64 | make.left.equalTo(superview.mas_left).offset(padding); | 64 | make.left.equalTo(superview.mas_left).offset(padding); |
65 | make.bottom.equalTo(superview.mas_bottom).offset(-padding); | 65 | make.bottom.equalTo(superview.mas_bottom).offset(-padding); |
66 | make.right.equalTo(superview.mas_right).offset(-padding); | 66 | make.right.equalTo(superview.mas_right).offset(-padding); |
67 | - make.height.equalTo(@[view1.mas_height, view2.mas_height]); //can pass array of attributes | 67 | + make.height.equalTo(@[greenView.mas_height, redView.mas_height]); //can pass array of attributes |
68 | }]; | 68 | }]; |
69 | 69 | ||
70 | return self; | 70 | return self; |
@@ -14,21 +14,21 @@ | @@ -14,21 +14,21 @@ | ||
14 | self = [super init]; | 14 | self = [super init]; |
15 | if (!self) return nil; | 15 | if (!self) return nil; |
16 | 16 | ||
17 | - UIView *view1 = UIView.new; | ||
18 | - view1.backgroundColor = UIColor.purpleColor; | ||
19 | - view1.layer.borderColor = UIColor.blackColor.CGColor; | ||
20 | - view1.layer.borderWidth = 2; | ||
21 | - [self addSubview:view1]; | 17 | + UIView *purpleView = UIView.new; |
18 | + purpleView.backgroundColor = UIColor.purpleColor; | ||
19 | + purpleView.layer.borderColor = UIColor.blackColor.CGColor; | ||
20 | + purpleView.layer.borderWidth = 2; | ||
21 | + [self addSubview:purpleView]; | ||
22 | 22 | ||
23 | - UIView *view2 = UIView.new; | ||
24 | - view2.backgroundColor = UIColor.orangeColor; | ||
25 | - view2.layer.borderColor = UIColor.blackColor.CGColor; | ||
26 | - view2.layer.borderWidth = 2; | ||
27 | - [self addSubview:view2]; | 23 | + UIView *orangeView = UIView.new; |
24 | + orangeView.backgroundColor = UIColor.orangeColor; | ||
25 | + orangeView.layer.borderColor = UIColor.blackColor.CGColor; | ||
26 | + orangeView.layer.borderWidth = 2; | ||
27 | + [self addSubview:orangeView]; | ||
28 | 28 | ||
29 | //example of using constants | 29 | //example of using constants |
30 | 30 | ||
31 | - [view1 mas_makeConstraints:^(MASConstraintMaker *make) { | 31 | + [purpleView mas_makeConstraints:^(MASConstraintMaker *make) { |
32 | make.top.equalTo(@20); | 32 | make.top.equalTo(@20); |
33 | make.left.equalTo(@20); | 33 | make.left.equalTo(@20); |
34 | make.bottom.equalTo(@-20); | 34 | make.bottom.equalTo(@-20); |
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | 37 | ||
38 | // auto-boxing macros allow you to simply use scalars and structs, they will be wrapped automatically | 38 | // auto-boxing macros allow you to simply use scalars and structs, they will be wrapped automatically |
39 | 39 | ||
40 | - [view2 mas_makeConstraints:^(MASConstraintMaker *make) { | 40 | + [orangeView mas_makeConstraints:^(MASConstraintMaker *make) { |
41 | make.center.equalTo(CGPointMake(0, 50)); | 41 | make.center.equalTo(CGPointMake(0, 50)); |
42 | make.size.equalTo(CGSizeMake(200, 100)); | 42 | make.size.equalTo(CGSizeMake(200, 100)); |
43 | }]; | 43 | }]; |
@@ -14,74 +14,74 @@ | @@ -14,74 +14,74 @@ | ||
14 | self = [super init]; | 14 | self = [super init]; |
15 | if (!self) return nil; | 15 | if (!self) return nil; |
16 | 16 | ||
17 | - UIView *view1 = UIView.new; | ||
18 | - view1.backgroundColor = UIColor.greenColor; | ||
19 | - view1.layer.borderColor = UIColor.blackColor.CGColor; | ||
20 | - view1.layer.borderWidth = 2; | ||
21 | - [self addSubview:view1]; | 17 | + UIView *greenView = UIView.new; |
18 | + greenView.backgroundColor = UIColor.greenColor; | ||
19 | + greenView.layer.borderColor = UIColor.blackColor.CGColor; | ||
20 | + greenView.layer.borderWidth = 2; | ||
21 | + [self addSubview:greenView]; | ||
22 | 22 | ||
23 | - UIView *view2 = UIView.new; | ||
24 | - view2.backgroundColor = UIColor.redColor; | ||
25 | - view2.layer.borderColor = UIColor.blackColor.CGColor; | ||
26 | - view2.layer.borderWidth = 2; | ||
27 | - [self addSubview:view2]; | 23 | + UIView *redView = UIView.new; |
24 | + redView.backgroundColor = UIColor.redColor; | ||
25 | + redView.layer.borderColor = UIColor.blackColor.CGColor; | ||
26 | + redView.layer.borderWidth = 2; | ||
27 | + [self addSubview:redView]; | ||
28 | 28 | ||
29 | - UILabel *view3 = UILabel.new; | ||
30 | - view3.backgroundColor = UIColor.blueColor; | ||
31 | - view3.numberOfLines = 3; | ||
32 | - view3.textAlignment = NSTextAlignmentCenter; | ||
33 | - view3.font = [UIFont systemFontOfSize:24]; | ||
34 | - view3.textColor = UIColor.whiteColor; | ||
35 | - view3.text = @"this should look broken! check your console!"; | ||
36 | - view3.layer.borderColor = UIColor.blackColor.CGColor; | ||
37 | - view3.layer.borderWidth = 2; | ||
38 | - [self addSubview:view3]; | 29 | + UILabel *blueView = UILabel.new; |
30 | + blueView.backgroundColor = UIColor.blueColor; | ||
31 | + blueView.numberOfLines = 3; | ||
32 | + blueView.textAlignment = NSTextAlignmentCenter; | ||
33 | + blueView.font = [UIFont systemFontOfSize:24]; | ||
34 | + blueView.textColor = UIColor.whiteColor; | ||
35 | + blueView.text = @"this should look broken! check your console!"; | ||
36 | + blueView.layer.borderColor = UIColor.blackColor.CGColor; | ||
37 | + blueView.layer.borderWidth = 2; | ||
38 | + [self addSubview:blueView]; | ||
39 | 39 | ||
40 | UIView *superview = self; | 40 | UIView *superview = self; |
41 | int padding = 10; | 41 | int padding = 10; |
42 | 42 | ||
43 | //you can attach debug keys to views like so: | 43 | //you can attach debug keys to views like so: |
44 | -// view1.mas_key = @"view1"; | ||
45 | -// view2.mas_key = @"view2"; | ||
46 | -// view3.mas_key = @"view3"; | 44 | +// greenView.mas_key = @"greenView"; |
45 | +// redView.mas_key = @"redView"; | ||
46 | +// blueView.mas_key = @"blueView"; | ||
47 | // superview.mas_key = @"superview"; | 47 | // superview.mas_key = @"superview"; |
48 | 48 | ||
49 | //OR you can attach keys automagically like so: | 49 | //OR you can attach keys automagically like so: |
50 | - MASAttachKeys(view1, view2, view3, superview); | 50 | + MASAttachKeys(greenView, redView, blueView, superview); |
51 | 51 | ||
52 | - [view3 mas_makeConstraints:^(MASConstraintMaker *make) { | 52 | + [blueView mas_makeConstraints:^(MASConstraintMaker *make) { |
53 | //you can also attach debug keys to constaints | 53 | //you can also attach debug keys to constaints |
54 | make.edges.equalTo(@1).key(@"ConflictingConstraint"); //composite constraint keys will be indexed | 54 | make.edges.equalTo(@1).key(@"ConflictingConstraint"); //composite constraint keys will be indexed |
55 | make.height.greaterThanOrEqualTo(@5000).key(@"ConstantConstraint"); | 55 | make.height.greaterThanOrEqualTo(@5000).key(@"ConstantConstraint"); |
56 | 56 | ||
57 | - make.top.equalTo(view1.mas_bottom).offset(padding); | 57 | + make.top.equalTo(greenView.mas_bottom).offset(padding); |
58 | make.left.equalTo(superview.mas_left).offset(padding); | 58 | make.left.equalTo(superview.mas_left).offset(padding); |
59 | make.bottom.equalTo(superview.mas_bottom).offset(-padding).key(@"BottomConstraint"); | 59 | make.bottom.equalTo(superview.mas_bottom).offset(-padding).key(@"BottomConstraint"); |
60 | make.right.equalTo(superview.mas_right).offset(-padding); | 60 | make.right.equalTo(superview.mas_right).offset(-padding); |
61 | - make.height.equalTo(view1.mas_height); | ||
62 | - make.height.equalTo(view2.mas_height).key(@340954); //anything can be a key | 61 | + make.height.equalTo(greenView.mas_height); |
62 | + make.height.equalTo(redView.mas_height).key(@340954); //anything can be a key | ||
63 | }]; | 63 | }]; |
64 | 64 | ||
65 | - [view1 makeConstraints:^(MASConstraintMaker *make) { | 65 | + [greenView makeConstraints:^(MASConstraintMaker *make) { |
66 | make.top.greaterThanOrEqualTo(superview.top).offset(padding); | 66 | make.top.greaterThanOrEqualTo(superview.top).offset(padding); |
67 | make.left.equalTo(superview.left).offset(padding); | 67 | make.left.equalTo(superview.left).offset(padding); |
68 | - make.bottom.equalTo(view3.top).offset(-padding); | ||
69 | - make.right.equalTo(view2.left).offset(-padding); | ||
70 | - make.width.equalTo(view2.width); | 68 | + make.bottom.equalTo(blueView.top).offset(-padding); |
69 | + make.right.equalTo(redView.left).offset(-padding); | ||
70 | + make.width.equalTo(redView.width); | ||
71 | 71 | ||
72 | - make.height.equalTo(view2.height); | ||
73 | - make.height.equalTo(view3.height); | 72 | + make.height.equalTo(redView.height); |
73 | + make.height.equalTo(blueView.height); | ||
74 | }]; | 74 | }]; |
75 | 75 | ||
76 | //with is semantic and option | 76 | //with is semantic and option |
77 | - [view2 mas_makeConstraints:^(MASConstraintMaker *make) { | 77 | + [redView mas_makeConstraints:^(MASConstraintMaker *make) { |
78 | make.top.equalTo(superview.mas_top).with.offset(padding); | 78 | make.top.equalTo(superview.mas_top).with.offset(padding); |
79 | - make.left.equalTo(view1.mas_right).offset(padding); | ||
80 | - make.bottom.equalTo(view3.mas_top).offset(-padding); | 79 | + make.left.equalTo(greenView.mas_right).offset(padding); |
80 | + make.bottom.equalTo(blueView.mas_top).offset(-padding); | ||
81 | make.right.equalTo(superview.mas_right).offset(-padding); | 81 | make.right.equalTo(superview.mas_right).offset(-padding); |
82 | - make.width.equalTo(view1.mas_width); | 82 | + make.width.equalTo(greenView.mas_width); |
83 | 83 | ||
84 | - make.height.equalTo(@[view1, view3]); | 84 | + make.height.equalTo(@[greenView, blueView]); |
85 | }]; | 85 | }]; |
86 | 86 | ||
87 | return self; | 87 | return self; |
-
Please register or login to post a comment