sean5
sean5

Reputation: 11

Objective C 'target action' in .m and 'outlet' in .h

I'm currently taking the Stanford CS193p iPhone and iPad application development course ( http://itunes.apple.com/itunes-u/ipad-iphone-application-development/id473757255 ) and in the second lecture I got stumped when he connected the buttons of the calculator to the .m file, he connected the display label (that shows the value on the calculator) to the .h file...

My understanding of the whole implementation and header file thing was that you declare the class members in header and say what they do in the implementation, which is why this doesn't make sense to me...

any help would be greatly appreciated

Upvotes: 1

Views: 634

Answers (1)

Kevin Grant
Kevin Grant

Reputation: 5431

It is possible in Objective-C for a .m file to contain methods for a class that the .h file for the class doesn't declare. In fact with the Categories feature of the language there can be more than one .h and .m that define all the methods for a class.

As far as what can be connected, the keyword IBOutlet marks properties or variables and IBAction marks action methods. These are just hints for the editor; all of the "connections" are set up at runtime automatically.

Upvotes: 0

Related Questions