-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUIView+SimplePosition.m
56 lines (43 loc) · 1020 Bytes
/
UIView+SimplePosition.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
//
// UIView+SimplePosition.m
//
// Created by Matej Hrescak on 3/1/14.
// Copyright (c) 2014 Matej Hrescak. All rights reserved.
//
#import "UIView+SimplePosition.h"
@implementation UIView (SimplePosition)
# pragma mark - Getters
- (CGFloat)x
{
return self.frame.origin.x;
}
- (CGFloat)y
{
return self.frame.origin.y;
}
- (CGFloat)width
{
return self.frame.size.width;
}
- (CGFloat)height
{
return self.frame.size.height;
}
# pragma mark - Setters
- (void)setX:(CGFloat)x
{
self.frame = CGRectMake(x, self.frame.origin.y, self.frame.size.width, self.frame.size.height);
}
- (void)setY:(CGFloat)y
{
self.frame = CGRectMake(self.frame.origin.x, y, self.frame.size.width, self.frame.size.height);
}
- (void)setWidth:(CGFloat)width
{
self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, width, self.frame.size.height);
}
- (void)setHeight:(CGFloat)height
{
self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, height);
}
@end