开发者

Different method types?

I'm familiar (or at least getting familiar) with instance and开发者_Python百科 class methods in objective-c, but have also seen method implementations that look like this:

#import "Utilities.h"
#import "CHAPPAppDelegate.h"
#import "AppState.h"

@implementation Utilities

CHAPPAppDelegate* GetAppDelegate() {
    return (CHAPPAppDelegate *)[UIApplication sharedApplication].delegate;
}

AppState* GetAppState() {
    return [GetAppDelegate() appState];
}

@end

What are these? While I'm sure this is documented somewhere, I don't know what term to use in searching for an explanation of what's being done here. I like the syntax methods like this let me use when calling them, but I'm not sure exactly what I'm doing, what the implications are, how to send parameters to these types of functions, etc?


These are c functions that wrap objective-c functions.


Those aren't methods at all. They are just functions, exactly like in normal C. They aren't part of the class. The body of the functions are written in Objective-C (i.e. the functions send messages to objects), but functions themselves are completely independent of objects and Objective-C.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜