Featured post

Difference between protocol and delegates?

A protocol, declared with the ( @protocol syntax in Objective-C) is used to declare a set of methods that a class "adopts" (de...

Thursday, 9 April 2015

What is readonly in Objective C?

-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; -

No comments:

Post a Comment