开发者

What are @property, @synthesize, @implementation, @interface in iphone programming?

开发者 https://www.devze.com 2023-02-05 01:37 出处:网络
I am new to iPhone programming, and want to know: What are @property开发者_C百科, @synthesize, @implementation, @interface in iPhone programming?@property generates prototypes for getter and setter m

I am new to iPhone programming, and want to know:

What are @property开发者_C百科, @synthesize, @implementation, @interface in iPhone programming?


@property generates prototypes for getter and setter methods. You usually place it in an @interface block which is itself in a .h file. The @interface block is where you declare a object's methods and attributes.

@synthesize generates getter and setter methods. You usually place it in an @implementation block which is itself in a .m file. The @implementation block is where you write the code of the object's methods.


@property is an objective C directive that allows to generate accessors.here we can specify the name and type of the property

@synthesize directive automatically generates setters and getters for us

• interface : the interface of class is usually stored in .h file and defines instance variables and public methods

• implementation : The implementation of a class is in .m file and usually contains the actual code of the methods

0

精彩评论

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

关注公众号