typedef struct objc_selector *SEL;
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,SEL键入objective-c是指向struct objc_selector.所以,如果我做一个SEL像这样的变量:
SEL aSel = @selector(instanceMethod) //Like this
Run Code Online (Sandbox Code Playgroud)
怎么了?@selector对实例方法做了什么,instanceMethod?
如果我没有弄错,结构意味着对象,结构指针意味着指向对象的指针吗?在一篇文章中,它说类是结构,这意味着它们是对象.
Filter the list of all classes
The traditional definition of a class in Objective-C looks like this:
struct objc_class {
Class isa;
Class super_class;
const char *name;
long version;
long info;
long instance_size;
struct objc_ivar_list *ivars;
struct objc_method_list **methodLists;
struct objc_cache *cache;
struct objc_protocol_list *protocols;
};
Run Code Online (Sandbox Code Playgroud)
所以,如果它说类是结构体,那么它们如何适应参数objc_msgSend(id self, SEL_cmd)需要一个类型为的结构指针id?