//屏幕寬度:#define kSCREENWIDTH ? [[UIScreen mainScreen] bounds].size.width
//屏幕高度:#define kSCREENHEIGHT ? [[UIScreen mainScreen] bounds].size.height
//屏幕尺寸:#define WINSIZE [[UIScreen mainScreen] bounds].size
程序更新:[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"程序地址"]]
//圖片名獲取圖片:#define IMG(name) [UIImage imageNamed:name]
//獲取系統(tǒng)版本
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
#define CurrentSystemVersion [[UIDevice currentDevice] systemVersion]
#define isIOS4 ([[[UIDevice currentDevice] systemVersion] intValue]==4)
#define isIOS5 ([[[UIDevice currentDevice] systemVersion] intValue]==5)
#define isIOS6 ([[[UIDevice currentDevice] systemVersion] intValue]==6)
#define isIOS7 ([[[UIDevice currentDevice] systemVersion] intValue]==7)
#define isIOS8 ([[[UIDevice currentDevice] systemVersion] intValue]==8)
#define isIOS9 ([[[UIDevice currentDevice] systemVersion] intValue]==9)
#define isIOS10 ([[[UIDevice currentDevice] systemVersion] intValue]==10)
#define isAfterIOS4 ([[[UIDevice currentDevice] systemVersion] intValue]>4)
#define isAfterIOS5 ([[[UIDevice currentDevice] systemVersion] intValue]>5)
#define isAfterIOS6 ([[[UIDevice currentDevice] systemVersion] intValue]>6)
#define isAfterIOS7 ([[[UIDevice currentDevice] systemVersion] intValue]>7)
#define isAfterIOS8 ([[[UIDevice currentDevice] systemVersion] intValue]>8)
本地地址:#define UserInfoFilePath [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject] stringByAppendingPathComponent:@"本地文件名"]
//-------------------打印日志-------------------------
//DEBUG ?模式下打印日志,當(dāng)前行
#ifdef DEBUG
# ? define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# ? define DLog(...)
#endif
//重寫NSLog,Debug模式下打印日志和當(dāng)前行數(shù)
#if DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr,"\\nfunction:%s line:%d content:%s\\n", __FUNCTION__, __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define NSLog(FORMAT, ...) nil
#endif
//獲取系統(tǒng)版本
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
#define CurrentSystemVersion [[UIDevice currentDevice] systemVersion]
//判斷是真機(jī)還是模擬器
#if TARGET_OS_IPHONE
//iPhone Device
#endif
#if TARGET_IPHONE_SIMULATOR
//iPhone Simulator
#endif
//讀取本地圖片
#define LOADIMAGE(file,ext) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:file ofType:ext]]
//定義UIImage對象
#define IMAGE(A) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:A ofType:nil]]
//----------------------顏色類---------------------------
// rgb顏色轉(zhuǎn)換(16進(jìn)制->10進(jìn)制)
#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]
//帶有RGBA的顏色設(shè)置
#define COLOR(R, G, B, A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]
// 獲取RGB顏色
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)
//背景色
#define BACKGROUND_COLOR [UIColor colorWithRed:242.0/255.0 green:236.0/255.0 blue:231.0/255.0 alpha:1.0]
//清除背景色
#define CLEARCOLOR [UIColor clearColor]
//定義一個API
#define APIURL ? ? ? ? ? ? ? ?@"http://xxxxx/"
//登陸API
#define APILogin ? ? ? ? ? ? ?[APIURL stringByAppendingString:@"Login"]
//G-C-D
#define BACK(block) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block)
#define MAIN(block) dispatch_async(dispatch_get_main_queue(),block)
//NSUserDefaults 實例化
#define USER_DEFAULT [NSUserDefaults standardUserDefaults]
//單例化一個類
#define SYNTHESIZE_SINGLETON_FOR_CLASS(classname) \\
\\
static classname *shared##classname = nil; \\
\\
+ (classname *)shared##classname \\
{ \\
@synchronized(self) \\
{ \\
if (shared##classname == nil) \\
{ \\
shared##classname = [[self alloc] init]; \\
} \\
} \\
\\
return shared##classname; \\
} \\
\\
+ (id)allocWithZone:(NSZone *)zone \\
{ \\
@synchronized(self) \\
{ \\
if (shared##classname == nil) \\
{ \\
shared##classname = [super allocWithZone:zone]; \\
return shared##classname; \\
} \\
} \\
\\
return nil; \\
} \\
\\
- (id)copyWithZone:(NSZone *)zone \\
{ \\
return self; \\
}
#endif