Define_Const.h
6.6 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
//
// Define_Const.h
// coffee-app-ios
//
// Created by 钱鋆 on 15/8/11.
// Copyright (c) 2015年 xn. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Define_Const : NSObject
// 判断是否是iphoneX
#define KIsiPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
// 根据状态栏高度判断是否开启了热点
#define STATUS_BAR_BIGGER_THAN_20 [UIApplication sharedApplication].statusBarFrame.size.height > 20
// 从云信移植
#define SuppressPerformSelectorLeakWarning(Stuff) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
Stuff; \
_Pragma("clang diagnostic pop") \
} while (0)
#define IOS8 ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 8.0)
#define kStatusBarHeight [UIApplication sharedApplication].statusBarFrame.size.height
#pragma mark 根据给定的标注尺寸计算实际宽度
/**
* @author qianjun
*
* @brief 根据给定的标注尺寸计算实际宽度
*
* @param width 给定标注尺寸下的控件宽度
* @param basicWidth 给定标注图的宽度
*
* @return 计算后的真实宽度
*/
#define f_CalcRealWidth(width,basicWidth) (float)width/(float)basicWidth*(float)ScreenWidth
#pragma mark 根据给定的标注尺寸计算实际高度
/**
* @author qianjun
*
* @brief 根据给定的标注尺寸计算实际高度
*
* @param height 给定标注尺寸下的控件高度
* @param basicHeight 给定的标注图的高度
*
* @return 计算后的真实高度
*/
#define f_CalcRealHeight(height,basicHeight) (float)height/(float)basicHeight*(float)ScreenHeight
#pragma mark 根据标注尺寸(基于iPhone5尺寸)计算实际宽度
/**
* @author qianjun
*
* @brief 根据标注尺寸(基于iPhone5尺寸)计算实际宽度
*
* @param widthForiPhone5 iPhone5标注图下的实际宽度
*
* @return 计算后的真实宽度
*/
#define f_CalcRealWidthByiPhone5(widthForiPhone5) (float)widthForiPhone5/640.0f*(float)ScreenWidth
#pragma mark 根据标注尺寸(基于iPhone5尺寸)计算实际高度
/**
* @author qianjun
*
* @brief 根据标注尺寸(基于iPhone5尺寸)计算实际高度
*
* @param heightForiPhone5 iPhone5标注图下的实际高度
*
* @return 计算后的真实高度
*/
#define f_CalcRealHeightByiPhone5(heightForiPhone5) (float)heightForiPhone5/1136.0f*(float)ScreenHeight
#pragma mark 根据标注尺寸(基于iPhone6尺寸)计算实际宽度
/**
* @author qianjun
*
* @brief 根据标注尺寸(基于iPhone6尺寸)计算实际宽度
*
* @param widthForiPhone6 iPhone6标注图下的实际宽度
*
* @return 计算后的真实宽度
*/
#define f_CalcRealWidthByiPhone6(widthForiPhone6) (float)widthForiPhone6/750.0f*(float)ScreenWidth
#pragma mark 根据标注尺寸(基于iPhone6尺寸)计算实际高度
/**
* @author qianjun
*
* @brief 根据标注尺寸(基于iPhone6尺寸)计算实际高度
*
* @param heightForiPhone6 iPhone6标注图下的实际高度
*
* @return 计算后的真实高度
*/
#define f_CalcRealHeightByiPhone6(heightForiPhone6) (float)heightForiPhone6/1334.0f*(float)ScreenHeight
#pragma mark 根据开发注尺寸(基于iPhone7尺寸)计算实际宽度
/**
* @author zsq
*
* @brief 根据开发尺寸(基于iPhone7尺寸)计算实际宽度
*
* @param widthForiPhone7 iPhone7开发图下的实际宽度
*
* @return 计算后的真实宽度
*/
#define f_CalcDevWidthByiPhone7(widthForiPhone7) widthForiPhone7/375.0f*ScreenWidth
#pragma mark 根据开发尺寸(基于iPhone7尺寸)计算实际高度
/**
* @author zsq
*
* @brief 根据开发尺寸(基于iPhone7尺寸)计算实际高度
*
* @param heightForiPhone7 iPhone7开发图下的实际高度
*
* @return 计算后的真实高度
*/
#define f_CalcDevHeightByiPhone7(heightForiPhone7) (float)heightForiPhone7/(667.0f)*(float)ScreenHeight
#define f_CalcRealWidthByiPhoneX(widthForiPhoneX) (float)widthForiPhoneX/1125.0f*(float)ScreenWidth
#define f_CalcRealHeightByiPhoneX(widthForiPhoneX) (float)widthForiPhoneX/2436.0f*(float)ScreenWidth
#pragma mark 当前设备屏幕宽度
/**
* @author qianjun
*
* @brief 当前设备屏幕宽度
*/
#define ScreenWidth ([[UIScreen mainScreen] bounds].size.width)
#pragma mark 当前设备屏幕高度
/**
* @author qianjun
*
* @brief 当前设备屏幕高度
*/
#define ScreenHeight ([[UIScreen mainScreen] bounds].size.height)
#define APPDELEGATE ((AppDelegate*)[[UIApplication sharedApplication] delegate])
//系统版本
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
//定义手势密码
#define KGESTUREPWD @"gesturePWD"
//#define g_Server @"192.168.1.46"
#define g_Server @"im.xiniunet.com"
#define g_Port 5222
#define g_Tenant_ID @"800000"
#define SERVER @"im.xiniunet.com"
#define RESOURCE @"/XINIU_PC"
#define GROUPFLAG @"@group"
#define TENANTFLAG @"@tenant"
#define g_FILE_SERVER @"112.124.121.74"
#define g_FILE_PORT 9094
// 通知定义
#define NOTIFICATION_CHANGE_GROUPNAME @"notification_change_groupname"
#define NOTIFICATION_GROUP @"notification_group"
#define NOTIFICATION_LOGOUT @"notification_logout"
#define NOTI_TENANTMEMBER_INFO @"noti_tenantmember_info"
#define NOTI_USER_PRESENCE @"noti_user_presence"
#define NOTI_DOWNFILE_RESULT @"noti_download_file"
// 云信相关的通知
#define NOTI_NIM_LOGOUT @"NOTI_NIMSDK_LOGOUT"
// 短信验证码登录
#define NOTI_SMSLOGIN_SAVEUSERINFO @"NOTI_SMSLOGIN_SAVEUSERINFO"
#define IOS8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0)
#define IOS10_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue]>=10.0)
#define iOS13_OR_LATER ([UIDevice currentDevice].systemVersion.floatValue >= 13.0f)
#define kNavBarHeight 44.0
//#define BOTTOM_OFFSET ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49)
#define BOTTOM_OFFSET 49.0
#define TOP_OFFSET (kStatusBarHeight + kNavBarHeight)
//#define SAFEAREA_BOTTOM ([[UIApplication sharedApplication] statusBarFrame].size.height>20?34:0)
#define SAFEAREA_BOTTOM 34.0
#define DEFAULT_SESSION @"638159439018725376"
#define enumToString(value) @#value
// 禁用函数,编译时提示错误
#define UNAVAILABLE(__arg__) __attribute__((unavailable(__arg__)))
// 这是云信的通知定义,位于NTESSystemNotificationCell中
typedef NS_ENUM(NSInteger, NotificationHandleType) {
// 待处理
NotificationHandleTypePending = 0,
// 已同意
NotificationHandleTypeOk,
// 已拒绝
NotificationHandleTypeNo,
// 已过期
NotificationHandleTypeOutOfDate
};
typedef void(^ForumShareSelectFinishBlock)(NSObject *);
@end