(一)pch中宏定义
如下图:

(二)调用:

(三)代码:
#ifndef PrefixHeader_pch
#define PrefixHeader_pch
//如果oc 执行以下
#ifdef __OBJC__
//日志
#ifdef DEBUG
#define ZWJLog(...)NSLog (__VA_ARGS__)
#else
#define ZWJLog(...)
#endif
//颜色
#define ZWJColorA(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)/255.0]
#define ZWJColor(r,g,b) ZWJColorA(r,g,b,255.0);
#define ZWJRandomColor ZWJColor(arc4random_uniform(255),arc4random_uniform(255),arc4random_uniform(255))
//国际化:
#define _ZWJLocalizedString(str) NSLocalizedString(str, nil)
#import "XMGPerson.h"
// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
#endif
#endif /* PrefixHeader_pch */
网友评论