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
//
// GMConstant.m
// GMKit
//
// Created by wangyang on 2017/11/8.
//
#import "Constant.h"
@implementation Constant
+ (CGRect)screenBounds {
return [[UIScreen mainScreen] bounds];
}
+ (CGFloat)screenWidth {
return [[UIScreen mainScreen] bounds].size.width;
}
+ (CGFloat)statusBarHeight{
return [UIApplication sharedApplication].statusBarFrame.size.height;
}
+ (CGFloat)screenHeight {
return [[UIScreen mainScreen] bounds].size.height;
}
+ (CGFloat)onePixel {
return 1/[UIScreen mainScreen].scale;
}
+ (CGFloat)deviceScale {
return [UIScreen mainScreen].scale;
}
+ (NSString *)appName {
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];
}
+ (NSString *)appVersion {
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
}
+ (NSString *)appBuildVersion {
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
}
+ (NSString *)appHome {
return NSHomeDirectory();
}
+ (NSString *)appTemp {
return NSTemporaryDirectory();
}
+ (NSString *)appDocument {
return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
}
+ (NSString *)appBundle {
return [NSBundle mainBundle].resourcePath;
}
@end