系统宏汇集
__FILE__
__FUNCTION__
当前函数名称
__LINE__
__TIME__
此字符串字面值包含编译时间,格式为“hh:mm:ss”(范例:“08:00:59”)。
__STDC__
整数常量1,表示此编译器遵循ISOC标准。
__STDC_VERSION__
__STDC_EOBTED__
__STDC_IEC_559__
__STDC_IEC_559_COMPLEX__
__STDC_ISO_10646__
1、release时,屏蔽log
2、在主线程或在后台执行block
- #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)
3、设备相关
- #define
isRetina ([UIScreen instancesRespondToSelect or:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO) -
- #define
iPhone5 ([UIScreen instancesRespondToSelect or:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO) -
- #define
isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) -
- #define
CurrentSystemVersion ([[UIDevice currentDevice] systemVersion]) -
- #define
CurrentLanguage ([[NSLocale preferredLanguages] objectAtIndex:0])
4、区分模拟器和真机
- #if
TARGET_OS_IPHONE - //iPhone
Device - #endif
-
- #if
TARGET_IPHONE_SIMULATOR - //iPhone
Simulator - #endif
5、根据是否使用ARC做不同操作
本文深入探讨了C语言编程中的关键概念和技术,包括文件路径、日期和时间宏、调试控制、多线程操作、设备识别、ARC支持、以及设备与模拟器的区分。文章详细解释了如何利用这些特性进行高效编程,特别强调了在不同设备和环境下的最佳实践。

1190

被折叠的 条评论
为什么被折叠?



