Example:
@property (..., assign)
there, I don't do any cleanup in the dealloc Method. But when I have an
@property (..., retain)
then I would do so.
I have that from somewhere in the internet. Don't remember the site. Well, I know that the retain-keyword in the compiler directive would make a retain count +1, but actually I think that I missed the deep difference in assign and retain.
Assign will only copy the pointer, and don't send a retain
message to the object. Thus, since you are not retaining it, you don't have to release it.
In case of retain, as you say, it will send a retain
message to the object, incrementing its retain count, so you are responsible of sending that object a release
message when your object is (in your dealloc
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.