properties - purpose of @property in objective c -
look below code;
@interface testviewcontroller : uiviewcontroller { int age; uipopovercontroller *popovercontroller; } @property (nonatomic , retain ) int age; @property (nonatomic , retain ) uipopovercontroller *popovercontroller; @end
@property (nonatomic , retain ) int age
defines getters , setters int age;
, @synthesizing
them in implemetation gives autogenerated implementation of getter , setter.
what dont understand second one. methods second property (@property (nonatomic , retain ) uipopovercontroller *popovercontroller;
) generate? (:
i have seen lot of programs use @property
objects apart int, string etc;
can guide me proper tutorial this.
thanks in advance. (also can tell me how accept answers on stackoverflow).
it difficult advise better official documentation (at least should start reading it).
@property (nonatomic , retain ) int age;
is supposed declare setter/getter methods age ivar, line give compiler error can't declare property retain attribute non-object types (see docs more details)
@property (nonatomic , retain ) uipopovercontroller *popovercontroller;
this line not differ 1st 1 - declares setter , getter methods popovercontroller ivar, , automatically synthesized setter retain popovercontroller gets
Comments
Post a Comment