objective c - Question regarding @property -
i'm kinda new in obj-c , ask why need write this?
@property (_something, _something) nsstring* name; what @property indicates for? why need put _something in bracket?
ps: know there no _something, should nonatomic, retain, copy , on. since has many options, that's why put word indicate content inside bracket. (where can list of available options?)
thanks :d
@property indicates defining property, @ basic level syntactic sugar allows variable = object.property , object.property = value instead of variable = [object property] , [object setproperty:value]. if wanted, skip declaring properties , declare getter , setter methods directly , runtime hardly notice difference.
the things inside parentheses modify property. many useful properties getter and/or setter implementations created using @synthesize in @implementation block. example, assign (the default) says value set set; retain says object set automatically have retain method called (and previous object, if any, have release called); , copy says object have copy called.
a list of possible attributes in the documentation.
Comments
Post a Comment