1.通用的宏定義
#ifndef define_h
#define define_h
2.獲取系統(tǒng)對(duì)象
#define GApplication[UIApplication sharedApplication]
#define GAppWindow [UIApplication sharedApplication].delegate.window
#define GAppDelegate[AppDelegate shareAppDelegate]
#define GRootViewController[UIApplication sharedApplication].delegate.window.rootViewController
#define GUserDefaults[NSUserDefaults standardUserDefaults]
#define GNotificationCenter[NSNotificationCenter defaultCenter]
3.獲取屏幕寬高
#define GScreenWidth[[UIScreen mainScreen]bounds].size.width
#define GScreenHeight[[UIScreen mainScreen]bounds].size.height
#define GScreen_Bounds[UIScreen mainScreen].bounds
4.強(qiáng)弱引用
#define GWeakSelf(type)__weak?typeof(type)weak##type?=?type;
#define GStrongSelf(type)__strong?typeof(type)type?=?weak##type;
5.DEBUG模式下打印日志,當(dāng)前行
#ifdef?DEBUG
#define GLog(fmt,...)NSLog((@"%s[Line?%d]"?fmt),__PRETTY_FUNCTION__,__LINE__,##__VA_ARGS__);
#else
#define GLog(...)
#endif