I have 1 word for this shit - Yuck.
A quick summary of properties:
@property (nonatomic, readonly) int* me
creates a getter: object.me
@property (nonatomic, readwrite) int* me
creates a getter + setter (DEFAULT)
@property (nonatomic, assign) NSString* myStr
'Normal' assign - does not increase reference count. (DEFAULT)
@property (nonatomic, retain) NSString* myStr
as above but increases the reference count by 1. (Retains the String - dont release this I'm using it!).
@property (nonatomic, copy) NSString* myStr
clone.
For Primitives use retain.
For Objects that may change & Strings use copy
Style: Only release the object if you created it. Objects returned from methods should be using autorelease this means you do not have to worry about cleaning up the object when you have finished with it.
Further reading
No comments:
Post a Comment