Reputation: 2170
What is the safe and correct way of calling a class method from an instance method in objective - C ?
Upvotes: 0
Views: 154
Reputation: 58261
you can do like:
- (void)your_instanceMethodB
{
[[self class] your_classMethodA];
}
READ this: Call a class method from within that class . Jon Reid and others answers.
Upvotes: 2
Reputation: 3937
If you are using subclasses and your subclass overrides the method, then you should do
[[self class] myFunction];
If not, the standard way is correct
[MyClass myFunction];
Upvotes: 1