-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDevTest.m
More file actions
75 lines (61 loc) · 2.07 KB
/
DevTest.m
File metadata and controls
75 lines (61 loc) · 2.07 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
//
// ExampleVC6.m
// JCFrameLayout
//
// Created by abc on 17/4/1.
// Copyright © 2017年 jackcat. All rights reserved.
//
#import "DevTest.h"
#import "JCFrameLayout.h"
@interface DevTest ()
/**
* <#注释#>
**/
@property (nonatomic,strong) UIView *yellowView;
/**
* <#注释#>
**/
@property (nonatomic,strong) UIView *redView;
@end
@implementation DevTest
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
_yellowView = [[UIView alloc]init];
_yellowView.backgroundColor = [UIColor yellowColor];
[self.view addSubview:_yellowView];
[_yellowView jc_makeLayout:^(JCFrameMake *make) {
make.width.height.jc_equalTo(200);
make.center.equalTo(self.view);
}];
[_yellowView addObserver:self forKeyPath:@"frame" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
_redView = [[UIView alloc]init];
_redView.backgroundColor = [UIColor redColor];
[self.view addSubview:_redView];
[_redView jc_makeLayout:^(JCFrameMake *make) {
make.center.equalTo(_yellowView);
make.size.jc_equalTo(CGSizeMake(100, 100));
}];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
if (object == self.yellowView && [keyPath isEqualToString: @"frame"]) {
NSLog(@"--change = %@",change);
}else{
NSLog(@"--non--change = %@",change);
}
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
// [UIView animateWithDuration:1 animations:^{
// [_yellowView jc_makeLayout:^(JCFrameMake *make) {
// make.width.height.jc_equalTo(200);
// make.center.equalTo(self.view).jc_offset(CGPointMake(0, 50));
// }];
// [_redView jc_updateLayout];
// }];
// _yellowView.jc_x_value = 110;
// _yellowView.jc_y_value = 110;
// _yellowView.jc_width_value = 200;
// _yellowView.jc_height_value = 200;
// _yellowView.center = CGPointMake(100, 100);
}
@end