Hello World iPhone Native Application

March 27, 2008 // Posted in iPhone, mac os x, programming  

Finally Apple released an initial version of iPhone SDK Beta 2 which has Interface Builder. It’s really cool to create applications. I wanted to put together the first step of creating HelloWorld quickly on it.

  • Open XCode
  • Create a new Project as “Cocoa Touch Application”

  • Provide the project name as “HelloWorld” on your selected folder and Click Save

  • Open Interface Builder and Click “Cocoa Touch” tab on the top

  • Select Window and Click “Choose”
  • Design the UI something like the following:

  • Save it as MainWindow under the same folder as HelloWorld
  • When it prompts to include it for the build, Choose “HelloWorld” and click Add

  • Quit the Interface Builder
  • Go back to XCode and edit “HelloWorldAppDelegate.m”
  • Replace the content of the method applicationDidFinishLaunching with the following snippet. Save it and Run it.

// Create window

self.window = [[[NSBundle mainBundle] loadNibNamed:@”MainWindow” owner:self options:nil] objectAtIndex:0];

// Show window

[window makeKeyAndVisible];

Download the XCode Project: iPhone - HelloWorld.zip?

This entry was posted on March 27, 2008 at 10:20 pm and is filed under iPhone, mac os x, programming (Tags: , ). You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Comments (35)

Leave a Reply (name & email required)