-declaring your property as readonly you tell compiler to not generate setter method automatically.
-Indicates that the property is read-only.
-If you specify readonly, only a getter method is required in the @implementation block. If you use the @synthesize directive in
the @implementation block, only the getter method is synthesized. Moreover, if you attempt to assign a value using the dot syntax,
you get a compiler error.
Example:
@property (nonatomic, readonly) NSString *name;
@synthesize name; -
-Indicates that the property is read-only.
-If you specify readonly, only a getter method is required in the @implementation block. If you use the @synthesize directive in
the @implementation block, only the getter method is synthesized. Moreover, if you attempt to assign a value using the dot syntax,
you get a compiler error.
Example:
@property (nonatomic, readonly) NSString *name;
@synthesize name; -
No comments:
Post a Comment