Some Important Concepts Used in IPhone Code

Auto Generated Code in iPhone/iPad Teachnology

@interface - The interface in objective C is used to declare the methods and it's variables for data elements of the class. It is used in the declaration, which means in the ".h" file. It uses the NS type Object; NS stands for Next Step which was Steve Jobs's company. Now the NSframework is used in Apple Xcode.

@interface HelloUniverseAppDelegate : NSObject <UIApplicationDelegate>

Here UIApplicationDelegate is the protocol and the NSObject class and is the parent class of HelloUniverseAppDelegate.

@implementation - The implementation defines the methods that were declared using the interface. It is used in the implementation which means in the ".m" file.


@class - It declares the methods defined elsewhere in the whole application. It is less memory-intensive than an #import statement and in a compact device like iPhone/iPad it will be used more often than in Mac applications.

@class HelloUniverseController;

HelloUniverseAppDelegate : NSObject <UIApplicationDelegate>


@property  - It declares a property.

@property (nonatomic, retain) IBOutlet UIWindow *window;

In this, use two terms to set the property:

  • nonatomic: It means the first thread completes it's task before the next thread begins.
  • retain: It is a keyword for memory allocation; it works like a constructor.

@synthesize - It creates getter and setter methods for a property. A getter and setter function is used to assign and obtain values to an object. It means it gets the value for variables and the value for a particular variable. When we use @synthesize we do not have to explicitly define a get and set function for the object properties; it just get internally defined by the system.

@synthesize window;

IBOutlet - It is a special instance variable that references another object. It is basically a collection of data source like images, PDF files etc. It lets the Interface builder know of the object. Here IB stands for Interface Builder which is a part of the UI.

 IBOutlet UIWindow *window

- It works like a trigger which is called from an Interface builder UI object. The trigger is used to alert when we want to gave any warning msg we create a trigger for it. IBAction performs an action on the Interface Builder.

- (IBAction)doBlueButton;