Is there a way to call a class method from another method within the same class?
For example:
+classMethodA{
}
+classMethodB{
//I would like to call classMethodA here
}
In a class method, self
refers to the class being messaged. So from within another class method (say classMethodB), use:
+ (void)classMethodB
{
// ...
[self classMethodA];
// ...
}
From within an instance method (say instanceMethodB), use:
- (void)instanceMethodB
{
// ...
[[self class] classMethodA];
// ...
}
Note that neither presumes which class you are messaging. The actual class may be a subclass.