@property (nonatomic, assign) Class aClass;
or
@property (nonatomic, retain) Class aClass;
Note: "Class" is that "Class" defined in objc.h
and does it need a release
in the dealloc
method?
@property (nonatomic, assign) Class aClass;
or
@property (nonatomic, retain) Class aClass;
Note: "Class" is that "Class" defined in objc.h
and does it need a release
in the dealloc
method?
Since it's a pointer to a class object, and class objects live for the lifetime of the app, memory management actions like retain
and release
have no effect on it. So it shouldn't matter whether you use assign
or release
. It would be simpler to use assign
.
If you use retain, the compiler will generate an object for you and retain it in the class. For such cases you should release it in the dealloc
.
Do not forget to add the synthesize though, otherwise you won't get any getter and setters.
Read more here: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProperties.html
And here: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProperties.html#//apple_ref/doc/uid/TP30001163-CH17-SW9