O'Reilly logo

Xcode 4 Cookbook by Steven F. Daniel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring and using compiler directives

In C/C++, we use directives to include any other header files that our application will need to access. This is done by using the #include directive. In Objective-C, we use the #import directive. If you examine the contents of the ViewController.h file, you will notice that at the top of the file is a #import statement.

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController
{
    IBOutlet UILabel     *lblFirstname;
    IBOutlet UITextField *txtFirstname;
    IBOutlet UILabel     *lblSurname;
    IBOutlet UITextField *txtSurname;
    IBOutlet UILabel     *lblOutput;
    IBOutlet UIButton    *btnTapHere;
}

The #import statement is known as a preprocessor directive. As mentioned previously, in C/C++, you would use the #include preprocessor ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required