How to add a prefix to a method with a C macro (this is a namespace assignment for the Obj-C category)?

How to add a prefix to a method with a macro C? For example:

#define CategoryName aNewCategory
#define Concatenate(prefix, methodName) prefix##_##methodName
#define AddCategoryPrefix(methodName) Concatenate(CategoryName, methodName)

@implementation NSObject(CategoryName)
+ (void) AddCategoryPrefix(logTask){
}
@end

The name of the method will be CategoryName_logTask, not aNewCategory_logTaskhow I want.

+4
source share

All Articles