-
Notifications
You must be signed in to change notification settings - Fork 0
/
UIView+BDKGeometry.h
77 lines (62 loc) · 2.34 KB
/
UIView+BDKGeometry.h
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
#import <UIKit/UIKit.h>
typedef enum {
BDKGeometryCenterHorizontally = 0,
BDKGeometryCenterVertically,
BDKGeometryCenterBoth,
} BDKGeometryCenter;
/** A set of geometry convenience methods for UIView.
*/
@interface UIView (BDKGeometry)
@property (nonatomic) CGPoint frameOrigin;
@property (nonatomic) CGFloat frameXOrigin;
@property (nonatomic) CGFloat frameYOrigin;
@property (nonatomic) CGSize frameSize;
@property (nonatomic) CGFloat frameWidth;
@property (nonatomic) CGFloat frameHeight;
@property (nonatomic) CGPoint boundsOrigin;
@property (nonatomic) CGFloat boundsXOrigin;
@property (nonatomic) CGFloat boundsYOrigin;
@property (nonatomic) CGSize boundsSize;
@property (nonatomic) CGFloat boundsWidth;
@property (nonatomic) CGFloat boundsHeight;
/** Origin modification helper.
* @param origin the origin to use.
*/
- (void)setOrigin:(CGPoint)origin __attribute__((deprecated));
/** X-origin modification helper.
* @param xOrigin the x-origin to use.
*/
- (void)setXOrigin:(CGFloat)xOrigin __attribute__((deprecated));
/** Y-origin modification helper.
* @param yOrigin the y-origin to use.
*/
- (void)setYOrigin:(CGFloat)yOrigin __attribute__((deprecated));
/** Size modification helper.
* @param size the size to use.
*/
- (void)setSize:(CGSize)size __attribute__((deprecated));
/** Width modification helper.
* @param width the width to use.
*/
- (void)setWidth:(CGFloat)width __attribute__((deprecated));
/** Height modification helper.
* @param height the height to use.
*/
- (void)setHeight:(CGFloat)height __attribute__((deprecated));
/** Positions a view directly beneath another view.
* @param view the view to position this view below.
*/
- (void)positionViewBelowView:(UIView *)view;
/** Positions a view directly beneath another view, with padding.
* @param view the view to position this view below.
* @param padding the padding to put between.
*/
- (void)positionViewBelowView:(UIView *)view padding:(CGFloat)padding;
/** Centers this view in another view.
* @param view the view in which to center the current view.
* @param direction whether to center vertically, horizontally, or both.
*/
- (void)centerInView:(UIView *)view direction:(BDKGeometryCenter)direction;
#pragma mark - Autolayout
- (void)constrainSubview:(UIView *)subview withAttribute:(NSLayoutAttribute)attribute constant:(CGFloat)constant;
@end