Tuesday, August 18, 2009

Hello World - iPhone

I have always been intrigued by iPhone apps and this is a long pending (self-learning) post of a simple 'Hello World' program in iPhone. This blog post serves to let the user get familiar with the iPhone code environment.

Creating a Project
  1. Download XCode along with IPhone's SDK from Apple's website.
  2. Once installed and opened, click File -> New Project
  3. Pick the Application template under iPhone OS category
  4. Select 'View-based application' and click Choose
  5. At this point, it will ask for the Project name -> Save
Once, the Project file is created, it will display all the code files and resources associated with the project. There isn't much now but it is a fully functional application that of course, does nothing. Click on the 'Build & Go' to see the iPhone Simulator open up the application.

XIB files are where the user interface behind the Mac and iPhone application are stored. Double clicking on the MainWindow.xib file will open up the Interface Builder app. This lets the user create the user interfaces. Once the IB loads, it displays a mock iPhone view. The users can select an array of objects (buttons, text boxes and the whole lot of it) from the Tools Library. If the Tools library is not automatically loaded, click Tools -> Libary or (command - shift+command+L)

Interface design
  1. On the TooNumbered Listls Library, make sure Object is selected. And then, in the search box start typing 'text'.
  2. Select TextView and drag it on the mock iPhone area and place it. Double clicking, lets you change the text. Then type the infamous - "Hello World!!"
  3. Close the Interface Builder and select 'Build & Go' on XCode window.

That's the simple 'Hello World!" app on iPhone.

I plan to explore more on iPhone and Objective C and plan to have series of posts. Looking forward to learning more!