If you are wondering how to declare a function/method in XCode when develop iPhone apps, you will need to declare a class level method in Objective-C by using “+” before the method declaration.
For example, you wanna create a static method called saySomething() in a common.h class and then implement the function in .m file.
common.h
[text]#import <Foundation/Foundation.h>
@interface common : NSObject {
}
+ (void) saySomething;
@end
[/text]
common.m
[text] #import "common.h"@implementation common
+ (void) saySomething{
NSLog(@"Hello iPhone application!");
}
@end
[/text]
That’s all, you can call it from anywhere.
Note: a “-“ before method declaration means instance methods and “+” means class level method which are not related with any particular instance of the class.