Example: I want to do this:
METHODNAME(5) {
// do something
}
which results in:
- (void)animationStep5 {
// do something
}
Is there any way to do this? Basically, what I need is a way to generate a real source code string before the program is compiled, so the compiler does see - (void)animationStep5…
Or maybe there’s something different than a macro, which can help here to auto-generate method names (not at run-time)?
You can use the concatenation operator
#define METHODNAME(i) -(void)animationStep##iyou can call it like
METHODNAME(5){}This expands to
-(void)animationStep5{}