-
Notifications
You must be signed in to change notification settings - Fork 4
/
EasyLayout.h
85 lines (61 loc) · 4.13 KB
/
EasyLayout.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
78
79
80
81
82
83
84
85
//
// EasyLayout.h
//
// Created by Ben Ford on 1/22/13.
// Copyright (c) 2013 Ben Ford
//
#import <UIKit/UIKit.h>
#import "QuickFrame.h"
@interface UIView(EasyLayoutMethods)
@property (nonatomic, assign) CGPoint extOrigin;
@property (nonatomic, assign) CGSize extSize;
@property (nonatomic, readonly) CGPoint extTerminus;
@property (nonatomic, readonly) CGPoint extMedial;
@property (nonatomic, readonly) CGSize extHalfSize;
@property (nonatomic, readonly) QuickFrame *extQuickFrame;
@property (nonatomic, readonly) NSString *extBoundsString;
@property (nonatomic, readonly) NSString *extFrameString;
- (void)extRemoveAllSubviews;
@end
@interface EasyLayout : NSObject
+ (void)topCenterView:(UIView *)targetView inParentView:(UIView *)parentView offset:(CGSize)offset;
+ (void)bottomCenterView:(UIView *)targetView inParentView:(UIView *)parentView offset:(CGSize)offset;
+ (void)centerView:(UIView *)targetView inParentView:(UIView *)parentView offset:(CGSize)offset;
+ (void)rightCenterView:(UIView *)targetView inParentView:(UIView *)parentView offset:(CGSize)offset;
+ (void)leftCenterView:(UIView *)targetView inParentView:(UIView *)parentView offset:(CGSize)offset;
+ (void)bottomRightView:(UIView *)targetView inParentView:(UIView *)parentView offset:(CGSize)offset;
+ (void)topRightView:(UIView *)targetView inParentView:(UIView *)parentView offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView toLeftOfView:(UIView *)siblingView offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView toRightAndVerticalCenterOfView:(UIView *)siblingView offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView toRightOfView:(UIView *)siblingView offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView atView:(UIView *)siblingView offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView belowView:(UIView *)siblingView offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView belowViews:(NSArray *)siblingViews offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView belowView:(UIView *)siblingView horizontallyCenterWithView:(UIView *)centerInView offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView belowView:(UIView *)siblingView horizontallyCenterInParent:(UIView *)centerInParent offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView aboveView:(UIView *)siblingView offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView aboveView:(UIView *)siblingView horizontallyCenterWithView:(UIView *)centerInView offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView aboveView:(UIView *)siblingView horizontallyCenterInParent:(UIView *)centerInParent offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView verticalCenterOfView:(UIView *)siblingVIew offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView centerOfView:(UIView *)siblingView offset:(CGSize)offset;
+ (void)modifyHeight:(UIView *)targetView toBottomOfView:(UIView *)siblingView offset:(CGFloat)offset;
+ (void)modifyHeight:(UIView *)targetView toTopOfView:(UIView *)siblingView offset:(CGFloat)offset;
+ (void)modifyHeight:(UIView *)targetView toBottomOfParent:(UIView *)parentView offset:(CGFloat)offset;
+ (void)modifyWidth:(UIView *)targetView toRightOfParent:(UIView *)parentView offset:(CGFloat)offset;
+ (void)positionView:(UIView *)targetView inbetweenHorizontallyFirstView:(UIView *)firstView secondView:(UIView *)secondView offset:(CGSize)offset;
+ (void)positionView:(UIView *)targetView inbetweenVerticallyFirstView:(UIView *)firstView secondView:(UIView *)secondView offset:(CGSize)offset;
+ (void)sizeView:(UIView *)targetView toParent:(UIView *)parentView edgeInsets:(UIEdgeInsets)edgeInsets;
+ (void)sizeView:(UIView *)targetView toParent:(UIView *)parentView insetSize:(CGSize)insetSize;
+ (void)sizeButton:(UIButton *)button matchHeightOfView:(UIView *)view;
@end
@interface EasyLayout(Inspection)
+ (UIView *)lowestViewFromArray:(NSArray *)arrayOfViews ignoreZeroHeight:(BOOL)ignoreZeroHeight;
@end
typedef enum
{
ELLineModeSingle = 0,
ELLineModeMulti,
} ELLineMode;
@interface EasyLayout(Label)
+ (void)sizeLabel:(UILabel *)label mode:(ELLineMode)lineMode maxWidth:(CGFloat)maxWidth;
@end