单军华
2018-07-12 3e8437ae559487362fae3525beb79c534c213a51
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
//
//  CommonHeader.pch
//  screendisplay
//
//  Created by 单军华 on 2018/6/29.
//  Copyright © 2018年 单军华. All rights reserved.
//
 
#ifndef CommonHeader_pch
#define CommonHeader_pch
 
// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
#pragma clang diagnostic ignored "-Wstrict-prototypes"
 
// category
#import "UIView+LMJNjHuFrame.h"
#import "MBProgressHUD+LMJ.h"
#import "UIView+GestureCallback.h"
#import "UIColor+Random.h"
#import "UIButton+LMJ.h"
#import "UITextView+WZB.h"
#import "NSDecimalNumber+Addtion.h"
 
// network
#import "Global.h"
#import "Utility.h"
 
// helpers
#import "TWConst.h"
//#import "LMJRequestManager.h"
#import "JXTAlertController.h"
#import "LMJEasyBlankPageView.h"
#import "UIImageView+FitNet.h"
 
// libs
#import <AFNetworking.h>
#import <IQKeyboardManager.h>
#import <Masonry.h>
#import <MBProgressHUD.h>
#import <MJExtension.h>
#import <MJRefresh.h>
#import <SDCycleScrollView.h>
#import <UIImageView+WebCache.h>
#import <YYAsyncLayer.h>
#import <YYCategories.h>
#import <YYImage.h>
#import <YYText.h>
#import <Toast.h>
#import <HMEmoticon.h>
 
//弱引用/强引用  可配对引用在外面用MPWeakSelf(self),block用MPStrongSelf(self)  也可以单独引用在外面用MPWeakSelf(self) block里面用weakself
 
#define TWWeak(type)  __weak typeof(type) weak##type = type
 
/**
 *  属性转字符串
 */
#define TWKeyPath(obj, key) @(((void)obj.key, #key))
 
//是否是空对象
#define TWIsEmpty(_object) (_object == nil \
|| [_object isKindOfClass:[NSNull class]] \
|| ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) \
|| ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0))
 
//不同屏幕尺寸字体适配
#define kScreenWidthRatio  (UIScreen.mainScreen.bounds.size.width / 375.0)
#define kScreenHeightRatio (UIScreen.mainScreen.bounds.size.height / 667.0)
#define AdaptedWidth(x)  ceilf((x) * kScreenWidthRatio)
#define AdaptedHeight(x) ceilf((x) * kScreenHeightRatio)
#define AdaptedFontSize(R)     [UIFont systemFontOfSize:AdaptedWidth(R)]
 
//由角度转换弧度
#define kDegreesToRadian(x)      (M_PI * (x) / 180.0)
//由弧度转换角度
#define kRadianToDegrees(radian) (radian * 180.0) / (M_PI)
 
// 设备类型判断
#define IsiPad     (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IsiPhone   (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IsRetain   ([[UIScreen mainScreen] scale] >= 2.0)
#define SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height
#define SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width
#define kScreenBounds [UIScreen mainScreen].bounds
 
 
#define ScreenMaxLength (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define ScreenMinLength (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))
 
#define IsiPhone4   (IsiPhone && ScreenMaxLength < 568.0)
#define IsiPhone5   (IsiPhone && ScreenMaxLength == 568.0)
#define IsiPhone6   (IsiPhone && ScreenMaxLength == 667.0)
#define IsiPhone6P  (IsiPhone && ScreenMaxLength == 736.0)
#define IsiPhoneX   (IsiPhone && ScreenMaxLength == 812.0)
 
// 设置颜色值
#define RgbColor(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
#define RGBA(r, g, b, a) ([UIColor colorWithRed:(r / 255.0) green:(g / 255.0) blue:(b / 255.0) alpha:a])
#define HexColor(hexValue) [UIColor colorWithRed:((float)((hexValue & 0xFF0000) >> 16)) / 255.0 green:((float)((hexValue & 0xFF00) >> 8)) / 255.0 blue:((float)(hexValue & 0xFF)) / 255.0 alpha:1.0]
 
#define BGCOLOR [UIColor colorWithRed:241/255.0 green:241/255.0 blue:241/255.0 alpha:1]
#define kUIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define NAVIGATIONTINTCOLOR kUIColorFromRGB(0x23c35c)
#define BLACKTEXTCOLOR_TITLE kUIColorFromRGB(0x303030)
#define BLACKTEXTCOLOR_SUB kUIColorFromRGB(0x7b7b7b)
#define BLUE_BUTTON_COLOR RgbColor(85, 81, 168)
 
//系统实例
#define UserDefault [NSUserDefaults standardUserDefaults]
#define Application [UIApplication sharedApplication]
#define GetAppDelegate [AppDelegate AppInstance]
 
// 其他常量
#define NavBar_Height  ((SCREEN_HEIGHT == 812) ? 88.0 : 64.0)
 
//打印文件函数行数
#if (DEBUG || TESTCASE)
#define LOG_INFO(format, ...) NSLog(format, ## __VA_ARGS__)
#else
#define LOG_INFO(format, ...)
#endif
 
// 日志输出宏
#define BASE_LOG(cls,sel) LOG_INFO(@"%@-%@",NSStringFromClass(cls), NSStringFromSelector(sel))
#define BASE_ERROR_LOG(cls,sel,error) LOG_INFO(@"ERROR:%@-%@-%@",NSStringFromClass(cls), NSStringFromSelector(sel), error)
#define BASE_INFO_LOG(cls,sel,info) LOG_INFO(@"INFO:%@-%@-%@",NSStringFromClass(cls), NSStringFromSelector(sel), info)
 
// 日志输出函数
#if (DEBUG || TESTCASE)
#define BASE_LOG_FUN()         BASE_LOG([self class], _cmd)
#define BASE_ERROR_FUN(error)  BASE_ERROR_LOG([self class],_cmd,error)
#define BASE_INFO_FUN(info)    BASE_INFO_LOG([self class],_cmd,info)
#else
#define BASE_LOG_FUN()
#define BASE_ERROR_FUN(error)
#define BASE_INFO_FUN(info)
#endif
 
#ifdef DEBUG
#define NSLogFunc NSLog(@"=====Begin==========\n FILE: %@\n FUNC: %s\n LINE: %d\n", [NSString stringWithUTF8String:__FILE__].lastPathComponent, __PRETTY_FUNCTION__, __LINE__)
#else
#define NSLogFunc
#endif
 
#endif /* PrefixHeader_pch */