//
|
// 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 */
|