//字符串是否為空
#define YStringEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
//數(shù)組是否為空
#define YArrayEmpty(array) (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)
//字典是否為空
#define YDictEmpty(dic) (dic == nil || [dic isKindOfClass:[NSNull class]] || dic.allKeys == 0)
//是否是空對(duì)象
#define YObjectIsEmpty(_object) (_object == nil \
||[_objectisKindOfClass:[NSNullclass]]\
||([_objectrespondsToSelector:@selector(length)]&&[(NSData*)_objectlength]==0)\
||([_objectrespondsToSelector:@selector(count)]&&[(NSArray*)_objectcount]==0))
//一些縮寫
#define YApplication????????[UIApplication sharedApplication]
#define YKeyWindow??????????[UIApplication sharedApplication].keyWindow
#define YAppDelegate????????[UIApplication sharedApplication].delegate
#define YUserDefaults?????? [NSUserDefaults standardUserDefaults]
#define YNotificationCenter [NSNotificationCenter defaultCenter]
// 通知
// 注冊(cè)通知
#define NOTIFY_ADD(_noParamsFunc, _notifyName)? [[NSNotificationCenter defaultCenter] \
addObserver:self \
selector:@selector(_noParamsFunc) \
name:_notifyName \
object:nil];
// 發(fā)送通知
#define NOTIFY_POST(_notifyName)? [[NSNotificationCenter defaultCenter] postNotificationName:_notifyName object:nil];
// 移除通知
#define NOTIFY_REMOVE(_notifyName) [[NSNotificationCenter defaultCenter] removeObserver:self name:_notifyName object:nil];
#define YImageNamed(s)? [UIImage imageNamed:s]
//APP版本號(hào)
#define YAppVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
//系統(tǒng)版本號(hào)
#define YSystemVersion [[UIDevice currentDevice] systemVersion]
//獲取沙盒Document路徑
#define YDocumentPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
//獲取沙盒temp路徑
#define YTempPath NSTemporaryDirectory()
//獲取沙盒Cache路徑
#define YCachePath [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]
//判斷是真機(jī)還是模擬器
#if TARGET_OS_IPHONE
//真機(jī)
#endif
#if TARGET_IPHONE_SIMULATOR
//模擬器
#endif
//開發(fā)的時(shí)候打印,但是發(fā)布的時(shí)候不打印的NSLog
#ifdef DEBUG
#define NSLog(...) NSLog(@"%s 第%d行 \n %@\n\n",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])
#else
#define NSLog(...)
#endif
//顏色
#define YRGBColor(r, g, b)???? [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
//由角度轉(zhuǎn)換弧度
#define kDegreesToRadian(x)??????(M_PI * (x) / 180.0)
//由弧度轉(zhuǎn)換角度
#define kRadianToDegrees(radian) (radian * 180.0) / (M_PI)
//獲取一段時(shí)間間隔
#define kStartTime CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();
#define kEndTime?? NSLog(@"Time: %f", CFAbsoluteTimeGetCurrent() - start)
// 導(dǎo)航
#define PUSH(VC) [self.navigationController pushViewController:VC animated:YES];
#define POPVC [self.navigationController popViewControllerAnimated:YES];
#define POPTOROOT [self.navigationController popToRootViewControllerAnimated:YES];
持續(xù)更新小結(jié)