Friday, November 28, 2008

Types and Contants in Objective-C

Objective-C programmers use a few types that are not found in the rest of the C world.

  • id is a pointer to any type of object
  • BOOL is the same as char, but is used as a Boolean value.
    YES is 1.
    NO is 0.
  • IBOutlet is a macro that evaluates to nothing. Ignore it. (IBOutlet is a hint to Interface Builder when it reads the declaration of a class from a .h file.)
  • IBAction is the same as void. It also acts as a hint to Interface Builder.
  • nil is the same as NULL. We use nil instead of NULL for pointers to objects.

No comments: