tags:

views:

68

answers:

2

What is the use of @property and @synthesize? Can you explain with an example please?

+3  A: 

Really short answer: They create accessors for the ivars.

There are some examples on wikipedia. Look at those.

Georg
+2  A: 

From the apple developer library:

You can think of a property declaration as being equivalent to declaring two accessor methods. Thus

@property float value;

is equivalent to:

- (float)value;

- (void)setValue:(float)newValue;

And by using @synthesize, the compiler creates accessor methods for you (see more here)

Rox