views:

70

answers:

1

In Java, I may have a class, for example, Utility and I have a static method called changeToCapitalLetter, so I can do something like this:

Utility.changeToCapitalLetter(myString);

How can I do the similar thing in Objective C?

Thanks a lot

+8  A: 

In Objective-C, you call this "class methods", see here:

@interface MyClass : NSObject

+ (void)aClassMethod;
- (void)anInstanceMethod;

@end

The + is the important thing; you call the method like this: [MyClass aClassMethod];

gammelgul
Right, but remember that you can always declare normal global C functions too.
Johannes Rudolph