This repository has been archived by the owner on Aug 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RFUI.m
51 lines (41 loc) · 1.76 KB
/
RFUI.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
#import "RFUI.h"
float RFUIDebugSlowAnimationsRatio = 10;
#pragma mark - RFEdge
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
bool RFEdgeEqualToEdge(RFEdge a, RFEdge b) {
if (a.top == b.top && a.right == b.right &&
a.bottom == b.bottom && a.left == b.left) {
return true;
}
return false;
}
RFEdge RFEdgeMake(float top, float right, float bottom, float left) {
RFEdge tmp;
tmp.top = top;
tmp.right = right;
tmp.bottom = bottom;
tmp.left = left;
return tmp;
}
RFEdge RFEdgeMakeWithRects(CGRect outterRect, CGRect innerRect) {
RFEdge tmp;
tmp.top = CGRectGetMinY(innerRect) - CGRectGetMinY(outterRect);
tmp.right = CGRectGetMaxX(outterRect) - CGRectGetMaxX(innerRect);
tmp.bottom = CGRectGetMaxY(outterRect) - CGRectGetMaxY(innerRect);
tmp.left = CGRectGetMinX(innerRect) - CGRectGetMinX(outterRect);
return tmp;
}
CGRect RFPaddingInsetContentFrameForRect(CGRect boxFrame, RFPadding padding) {
CGPoint a = CGPointMake(boxFrame.origin.x + padding.left, boxFrame.origin.y + padding.top);
CGPoint b = CGPointMake(boxFrame.origin.x + boxFrame.size.width - padding.right, boxFrame.origin.y + boxFrame.size.height - padding.bottom);
return CGRectMakeWithPoints(a, b);
}
const RFEdge RFEdgeZero = {0,0,0,0};
const RFMargin RFMarginZero = {0,0,0,0};
const RFBorder RFBorderZero = {0,0,0,0};
const RFPadding RFPaddingZero = {0,0,0,0};
#pragma clang diagnostic pop
#pragma mark - UIViewAutoresizing
NSUInteger const UIViewAutoresizingFlexibleSize = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
NSUInteger const UIViewAutoresizingFlexibleMargin = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin;