惯用的宏定义
#pragma mark ===============常用的宏定义================
#define kScreenHeight [[UIScreen mainScreen] bounds].size.height
#define kScreenWidth [[UIScreen mainScreen] bounds].size.width
#define kStateBarHeight 20
#define kMainHeight (ScreenHeight - StateBarHeight)
#define kMainWidth ScreenWidth
#define kIsIPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define BACKGROUND_CORLOR [UIColor colorWithRed:222.0/255 green:222.0/255 blue:222.0/255 alpha:1]
#define kUserDefault [NSUserDefaults standardUserDefaults]
#define kApplication [UIApplication sharedApplication]
#define kDataEnv [DataEnvironment sharedDataEnvironment]
#define kDegreesToRadian(x) (M_PI * (x) / 180.0)
#define kRadianToDegrees(radian) (radian*180.0)/(M_PI)
#define kRgbColor(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]
#define kRgbColor2(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
/* 根据名称加载有缓存图片 */
#define kImageNamed(name) [UIImage imageNamed:name]
//判断系统的当然版本。
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#pragma mark ===============不常用的宏定义================
#define kSystemError @"系统繁忙,请稍后再试!"
/* 获取系统目录 */
#define kGetDirectory(NSSearchPathDirectory) [NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory, NSUserDomainMask, YES)lastObject]
/* 获取NSFILEMANAGER对象 */
#define kFileManager [NSFileManager defaultManager]
/* 获取程序代理 */
#define kAppdelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
/* 获取任意WINDOW对象 */
#define kWindow [[[UIApplication sharedApplication] windows] lastObject]
/* 获取KEYWINDOW对象 */
#define kKeyWindow [[UIApplication sharedApplication] keyWindow]
/* 获取USERDEFAULTS对象 */
#define kNotificactionCenter [NSNotificationCenter defaultCenter]
/* 获取当前控制器的navigationBar */
#define kNavigationBar [[self navigationController] navigationBar]
/* 简单提示框 */
#define kAlert(title, msg) [[[UIAlertView alloc] initWithTitle:title message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]show]
/*------------------------------------加载图片---------------------------------------*/
/* 根据名称加载无缓存图片 */
#define kNoCacheImagewithName(name, ext) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:name ofType:ext]]
/* 根据路径加载无缓存图片 */
#define kNoCacheImagewithPath(path) [UIImage imageWithContentsOfFile:path]
/*------------------------------------视图------------------------------------------*/
/* 根据TAG获取视图 */
#define kViewWithTag(PARENTVIEW, TAG, CLASS) ((CLASS *)[PARENTVIEW viewWithTag:TAG])
/* 加载NIB文件 */
#define kLOADNIBWITHNAME(CLASS, OWNER) [[[NSBundle mainBundle] loadNibNamed:CLASS owner:OWNER options:nil] lastObject]
/* 异步 */
#define kGCDAsync(block) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block)
/* 同步 */
#define kGCDMain(block) dispatch_async(dispatch_get_main_queue(),block)
/*-----------------------------------界面尺寸--------------------------------------*/
/* 导航栏高度 */
#define kNavigationBarHeight 44
/* 工具栏高度 */
#define kTabBarHeight 49
/* 是否IPad */
#define kIsIpad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
/* 是否IPhone */
#define kIsIphone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
/* 获取系统信息 */
#define kSystemVersion [[UIDevice currentDevice] systemVersion]
/* 获取当前语言环境 */
#define kCurrentLanguage [[NSLocale preferredLanguages] objectAtIndex:0]
/* 获取当前APP版本 */
#define kAppVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
/*-----------------------------------调试相关--------------------------------------*/
#ifdef DEBUG
#define XLOG(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define XLOG(...);
#endif