1. About NSLog Output
/** * When Xcode is release does not output, for debug output * * @param ... * * @return * /#ifndef __optimize__#define NSLog (...) NSLog (__va_args__)/** * You can see the class name, method, and number of rows when printing * *///#define NSLOG (FMT,...) NSLog (@ "%s [line%d]" FMT), __pretty_function__, __line__, # # __va_args__); #else # define NSLOG (...) {} #endif
2. Color
#define RGB_COLOR (r,g,b) [Uicolor colorwithred: (r)/255.0 Green: (g)/255.0 Blue: (b)/255.0 alpha:1.0] #define Rgb_ Coloralpha (r,g,b,a) [Uicolor colorwithred: (r)/255.0 Green: (g)/255.0 Blue: (b)/255.0 alpha:a] #define RGB (rgbvalue) [ Uicolor colorwithred: ((float) ((Rgbvalue & 0xFF0000) >>)/255.0 Green: ((float) ((Rgbvalue & 0xff00) > > 8)/255.0 Blue: ((float) (Rgbvalue & 0xFF)/255.0 alpha:1.0] #define RGBALPHA (rgbvalue,a) [Uicolor colorwithred: ((float) ((Rgbvalue & 0xFF0000) >>)/255.0 Green: ((float) ((Rgbvalue & 0xff00) >> 8)/255.0 Blue: (float) (Rgbvalue & 0xFF))/255.0 Alpha: (a)]
3. Screen size
#define App_size [UIScreen mainscreen].bounds.size#define app_width ([UIScreen mainscreen].bounds.size.width) #define App_height ([UIScreen mainscreen].bounds.size.height)
4. System version
#define Ppsystemversiongreaterorequalthan (version) ([[[Uidevice Currentdevice] systemversion] Floatvalue] >= Version
<pre name= "code" class= "OBJC" > #define Ios_version [[[Uidevice Currentdevice] systemversion] floatvalue]
(constantly updated)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
ios-for easy project development Add some common macro definitions to the PCH