Learn Objective-C: Creating a New iPhone Project

Over the next few Lessons, we will be creating a full-functioned calculator, that can handle basic arithmetic, as well as fractional operations. By the end, we will also have a GUI (graphic user interface), but for now, we will be working off the console, as we have been doing.

We’ll begin by creating a new project in Xcode. Note that the screenshots below are from Xcode 3.2.3 running under OS X 10.6.5; the steps should be generally the same if you’re lucky enough to be running the newest version of Xcode. Note, however, that Xcode 4 is under NDA and is only available for paid developer program members; therefore, we will not be talking about Xcode 4 until it is officially released.

Let’s begin!

Creating the Xcode Project

Launch Xcode. If it’s not in your Dock already, navigate to /Developer/Applications, and ideally, drag it to your Dock; otherwise, you’ll have to look for it every time you launch the program.

xcode-app

When the launch window shows up, click “Create a new Xcode project”; alternatively, navigate to File > New Project (⇧⌘N). Choose the “Window-based Application”, and make sure “Product” is “iPhone.” Do not use Core Data. See the screenshot below:

xcode-new-iphone-project

Save the project anywhere on disk; I’d recommend having a dedicated “Developer” folder in your Home folder. (Of course, feel free to search for an icon that you can use for your folder.) I’d also strongly recommend that you save your project as “Calculator”; otherwise, your code could result in errors.

xcode-calculator

After you click “Save,” you’ll be presented with the main Xcode window. Note that yours probably will look a little different from mine, but the general functionality is still the same. If you wish to adopt my layout, I’m using the All-In-One layout, found in Xcode > Preferences > General > Layout.

xcode-simulator

Regardless of which view you use, you will see the File list, the Organizer, and the Toolbar. For this Lesson, we will only be concerned with the File list and Organizer. I’ll do an Extension on using Xcode later.

At the moment, click on Build and Run from the toolbar. After a brief moment, the iPhone Simulator will appear, and you will see a blank (white) screen.

xcode-iphone-white-screen

Here, you’re done…for now. Feel free to close the current project window…we’ll be returning to it in a few lessons. Hopefully though, this has whetted your appetite. We now move on to proper object-oriented programming.

This post is part of the Learn Objective-C in 24 Days course.

Author: Feifan Zhou