Home Tutorial Iphone Examples Hello World iphone Example

 
 

Share on Google+Share on Google+
Hello World iphone Example
Posted on: August 26, 2009 at 12:00 AM
Advertisement
In the given tutorial you will be creating a small iphone application called "hello world app" using interface builder, that will run in the iphone simulator. Before going into deep of this tutorial let's first understand what is interface builder.

Hello World iphone with Example

In the given tutorial you will be creating a small iphone application called "hello world app" using interface builder, that will run in the iphone simulator. Before going into deep of this tutorial let's first understand what is interface builder.

Interface Builder:
An application which is used to design and test the  user applications. That means using an interface builder a user can create new views or edit the existing one, they can also place different buttons, labels and text boxes etc...to it, according to the application requirement. In short, Interface builder is basically an Apple's graphical editor and this graphical editor can be used in both carbon and cocoa type of applications. You can pop up interface builder by simply clicking on .XIB file in your application Resources folder.

An interface builder exactly look like the given image...



Now let's look at the steps of creating your first "Hello World" app in iphone SDK. As this tutorial is designed for the beginners, i assume that you have already installed the XCode and SDK in your mac machine.

Steps of creating Hello World application in Iphone SDK:

1. Creating a new project:

   

Double click on the XCode icon and select file->New Project , a new project window will pop up. Now choose the type of project you wanted to create, here we choose "Window-based Application". provide the appropriate application name, and finally save it to your desired location.

   

2. Creating Interface Builder:
To create an user Interface , double click on MainWindow.xib file placed into the Resources folder in the left navigation bar. Double clicking on .xib file will open the Interface builder which is required to create the view.

    

3. Placing labels and writing text to it:
Now as you have open the Interface builder, you can see three different files 1. MainWindow.xib, 2. Window & 3. Library(if you can't find it then open it from tools->library).  On scrolling up & down you can see various options are available into the library. But here we are just going to place a Label on to the window. And you can do it by just drag and drop.





Double click on the label and write your message to it. As we have written "Hello World".


4. Testing the application:
Once you done with the Interface Builder close it. And click on the Build and Go button to test the application. As given in the image...


Your application will look like this..




Download the Source Code


    



 

Advertisement

Related Tags for Hello World iphone Example:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: August 26, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com