Confusion with header and Implementation files in Objective-C

Viewed 17841

First off, please forgive the stupidness of this question but Im not from a C/C++ background. I'm a little unclear about what the difference in roles between the .h and .m files when it comes to properties.

I understand the concept of interfaces, and I see that in part the .h file is an interface for the implementation, but what I am not clear on is this:

  • Why are properties/methods defined outside of the {} braces?
  • What am i defining in the braces when I write something like this:

    IBOutlet UITextField *numberField;

    Is this a field definition in an interface?

  • When I am adding the @Property lines to the .h files are these actual implementations of a n auto property or just an interface blueprint? If so is the @syntesis the actual implementation?

I guess my biggest confusion seems to be that if I want a property I'm defining what I need in three different places (1) in the interfaces braces, (2) as @property outside the braces and (3) with @synthesis in the .m file. This seems long winded, but its fine if I can work out what these three parts do.

Cheers, Chris.

4 Answers
Related