Synthesize in Objective C [duplicate]
开发者_如何学运维Possible Duplicate:
@property @synthesize
Explain the working or purpose of synthesize
Basically, @synthesize automatically generates the getters and setters based on the @property declaration.
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.
精彩评论