开发者

Synthesize in Objective C [duplicate]

This question already has answers here: Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜