Just realized that the delegates I am declaring are not declared with pointer type.
so instead of this
id <AddViewControllerDelegate> *delegate;
I have this
id <AddViewControllerDelegate> delegate;
开发者_运维百科
Why the last way is correct? Since self
is pointer(I guess) then why delegate is not?
'id' is already a pointer type. It's just hidden behind the typedef.
typedef id (*IMP)(id, SEL, ...);
typedef struct objc_class *Class;
typedef struct objc_object {
Class isa;
} *id;
id is actually a pointer to an object.
精彩评论