-2

Possible Duplicate:
@property @synthesize

Explain the working or purpose of synthesize

Community
  • 1
  • 1
suman
  • 761
  • 1
  • 6
  • 4
  • Please check existing questions before asking a new. There already are several questions same as this one. – Viraj Mar 02 '11 at 05:47

2 Answers2

0

Basically, @synthesize automatically generates the getters and setters based on the @property declaration.

Brian Liang
  • 7,734
  • 10
  • 57
  • 72
0

synthesize used with property.When you declair a property in .h file then you need to synthesize that in .m file.

@synthesize creates getter and setter for your property.If you do not synthesize the property then you can use property.(it gives crash).

var=self.yourProperty (calling getter). simmiler to var=[self getYourProperty];

self.yourProperty=var (calling setter). simmiler to [self setYourProperty:var];

without synthesize you cant use the setter and getter.

Ishu
  • 12,797
  • 5
  • 35
  • 51