Possible Duplicate:
What do the plus and minus signs mean in Objective C next to a method?
Had an error which I fixed by changing -(void) to +(void), but I would like the understand it.
Thanks.
This denotes an instance method. You must hold a valid instance of the class to call this method.
-(void)
This denotes a class method. You do not need an instance of the class to call this method.
+(void)
- methods are instance methods and called on a specific instance of a class.
While + methods are class methods and called on the class itself.
精彩评论