forked from AlexDenisov/FrameAccessor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUIView+FrameAccessor.m
73 lines (58 loc) · 1.3 KB
/
UIView+FrameAccessor.m
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
//
// UIView+FrameAccessor.m
// FrameAccessor
//
// Created by Alex Denisov on 18.03.12.
// Copyright (c) 2012 CoreInvader. All rights reserved.
//
#import "UIView+FrameAccessor.h"
@implementation UIView (FrameAccessor)
- (CGPoint)origin {
return self.frame.origin;
}
- (void)setOrigin:(CGPoint)newOrigin {
CGRect newFrame = self.frame;
newFrame.origin = newOrigin;
self.frame = newFrame;
}
- (CGSize)size {
return self.frame.size;
}
- (void)setSize:(CGSize)newSize {
CGRect newFrame = self.frame;
newFrame.size = newSize;
self.frame = newFrame;
}
- (CGFloat)x {
return self.frame.origin.x;
}
- (void)setX:(CGFloat)newX {
CGRect newFrame = self.frame;
newFrame.origin.x = newX;
self.frame = newFrame;
}
- (CGFloat)y {
return self.frame.origin.y;
}
- (void)setY:(CGFloat)newY {
CGRect newFrame = self.frame;
newFrame.origin.y = newY;
self.frame = newFrame;
}
- (CGFloat)height {
return self.frame.size.height;
}
- (void)setHeight:(CGFloat)newHeight {
CGRect newFrame = self.frame;
newFrame.size.height = newHeight;
self.frame = newFrame;
}
- (CGFloat)width {
return self.frame.size.width;
}
- (void)setWidth:(CGFloat)newWidth {
CGRect newFrame = self.frame;
newFrame.size.width = newWidth;
self.frame = newFrame;
}
@end