i’m a bit lost with the class methods, and “static” variables : what is the difference? for example, in a script with a mapView, we have this :
+(CGFloat)annotationPadding;
{
return 10.0f;
}
Why do we use this class method instead of a static variable, if the only we want is “the same value for that class” ?
Thanks
Paul
A class method is to a static variable what an instance method is to an instance variable.
One is a method that can do processing, the other is a variable that can hold – or point to – data.
You’d use a class method for convenience usage like e.g.
NSMutableArraydoes with thearrayclass method, or for processing that doesn’t require the object’s state to do the task.