HowToMakeAnActionMethod

Crowd-sourced documentation and tutorials by the Cocoa developer community
Jump to: navigation, search

Here is the meat of Objective-C programming! Here is how you create an action method using XCode. For an action method to work, you must

  • declare your action method in the header file (.h) - see HowToDeclareAnActionMethod,
  • write the code for the action method in the implemenation file (.m) - see HowToFillAnActionMethodWithCode,
  • call the action method. This can be done by linking the action method to a button (see HowToLinkAButtonToAnActionMethod) or menu item or by calling the action method from another method or another class. Also, some methods (such as drawRect:) will get called automatically, so you don't have to worry about calling them.


Make sure also to tell Interface Builder about changes you have made to the class in XCode - see HowToReadHeaderFilesFromProjectBuilderIntoInterfaceBuilder.

Go back to HowToProgramInOSX

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox