-
Notifications
You must be signed in to change notification settings - Fork 13
/
UIViewX.h
70 lines (54 loc) · 1.54 KB
/
UIViewX.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
//
// UIViewX.h
//
// Copyright (c) 2014 Anthony Shoumikhin. All rights reserved under MIT license.
// mailto:[email protected]
//
#import <UIKit/UIKit.h>
#ifndef CGVECTOR_DEFINED
#define CGVECTOR_DEFINED 1
typedef struct
{
CGFloat dx;
CGFloat dy;
} CGVector;
CG_INLINE CGVector
CGVectorMake(CGFloat dx, CGFloat dy)
{
CGVector vector; vector.dx = dx; vector.dy = dy; return vector;
}
#endif
@interface UIView (X)
@property (nonatomic) CGFloat x;
@property (nonatomic) CGFloat y;
@property (nonatomic) CGPoint origin;
@property (nonatomic) CGFloat width;
@property (nonatomic) CGFloat height;
@property (nonatomic) CGSize size;
@property (nonatomic) CGFloat dx;
@property (nonatomic) CGFloat dy;
@property (nonatomic) CGVector bound;
/**
Get a parent view controller.
@return Parent view controller.
*/
- (UIViewController *)viewController;
/**
Get a superview of specific class.
@param aClass Specific class to search.
@return Superview of class specified.
*/
- (UIView *)superviewOfClass:(Class)aClass;
/**
Search through the view hierarchy starting from this view and resign the first responder, if found.
@return YES, if the first responder was resigned, NO otherwise.
*/
- (BOOL)resignFirstResponderRecursively;
/**
Move view to a new position with animaton.
@param destination New coordinates for view's frame origin.
@param duration Duration of animation in seconds.
@param options Animation options.
*/
- (void)moveTo:(CGPoint)destination duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options;
@end