日子明确信息

#ifdef DEBUG

#  define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

#else

#  define DLog(...)

#endif

#if !DEBUG

#define NSLog(...) {}

#else

#define NSLog(...) NSLog(__VA_ARGS__)

#endif

 

系统

#define SYS_VERSION [[UIDevice currentDevice].systemVersion intValue]

#define IS_IOS7 (SYS_VERSION >= 7.0)

#define IS_IOS8 (SYS_VERSION >= 8.0)

 

#define SCREEN_WIDTH  [UIScreen mainScreen].bounds.size.width

#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

#define IPHONE6p ([UIScreen mainScreen].bounds.size.height == 736.)

#define IPHONE6 ([UIScreen mainScreen].bounds.size.height == 667.)

#define IPHONE5 ([UIScreen mainScreen].bounds.size.height == 568.)

#define FitWidth(w) (SCREEN_RATIO*(w))  // 根据4.7寸屏适配的宽度

#define FitHeight(h) (SCREEN_RATIO_HEIGHT*(h)) // 根据4.7寸屏适配的高度

 

#pragma mark - 全局参数

#define RGB(R,G,B) \

[UIColor colorWithRed:(R)/255.0f green:(G)/255.0f blue:(B)/255.0f alpha:1]

#define RGBA(R,G,B,A) \

[UIColor colorWithRed:(R)/255.0f green:(G)/255.0f blue:(B)/255.0f alpha:(A)]

#define UIColorFromRGB(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]

 

 

/** 获取沙盒 Document 路径*/
#define kDocumentPath       [NSSearc
 
#pragma mark - Check
/** 字符串是否为空*/
#define kStringIsEmpty(str)     ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
/** 数组是否为空*/
#define kArrayIsEmpty(array)    (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)
/** 字典是否为空*/
#define kDictIsEmpty(dic)       (dic == nil || [dic isKindOfClass:[NSNull class]] || dic.allKeys == 0)
/** 是否是空对象*/
#define kObjectIsEmpty(_object) (_object == nil \
                                || [_object isKindOfClass:[NSNull class]] \
                                || ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) \
                                || ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0))
 
 
 
 
hPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
/** 获取沙盒 temp 路径(注:iPhone 重启会清空)*/
#define kTempPath           NSTemporaryDirectory()
/** 获取沙盒 Cache 路径*/
#define kCachePath          [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]
/** 获取程序包中程序路径*/
#define kResource(f, t)     [[NSBundle mainBundle] pathForResource:(f) ofType:(t)];
 
 
#pragma mark - Base
/** 弱引用*/
#define kWeakSelf(type)   __weak typeof(type) weak##type = type;
/** 强引用*/
 
#define kStrongSelf(type) __strong typeof(type) type = weak##type;
/** 由角度转换弧度*/
#define kDegreesToRadian(x)      (M_PI * (x) / 180.0)
/** 由弧度转换角度*/
#define kRadianToDegrees(radian) (radian * 180.0) / (M_PI)