Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

like image 893
Veer Avatar asked Dec 02 '22 03:12

Veer


2 Answers

@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.

like image 109
Sylvain Avatar answered May 18 '23 00:05

Sylvain


@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

like image 22
Mehul Chuahan Avatar answered May 18 '23 01:05

Mehul Chuahan