CS193P: HelloPoly Walkthrough
The goal of this ‘walkthrough’ is to give you a fairly step by step path through building a simple Cocoa Touch
application. You are encouraged to follow the walkthrough, as it should help you successfully complete the
assignment, help you quickly become familiar with the tools and basic iPhone development workflow.
Also keep in mind, that although you will be navigating a series of steps in tools, what you are building is the
connected group of objects diagrammed below. You will define a controller object with instance variables
(outlets) that refer to the user interface elements.
The controller object implements behavior, action methods, that adjusts the number of sides of a polygon.
You will connect each control so that the target of the control is the controller, and the action that will be
sent is one of ‘increase’ or ‘decrease’.
Create a new Cocoa Touch project:
1. Select menu File > New Project…
Select iPhone OS Application, then choose the Window-Based Application template
3. Name the project ‘HelloPoly’
Assignment 2A Walkthrough
Page 1 of 14
Setting the Active SDK
For simplicity, we’ll use the iPhone Simulator in this walkthrough. When building iPhone applications you
need to tell Xcode which platform to build against. To change the Active SDK use the Project > Set Active
SDK menu item. Set this to ‘Simulator - iPhone OS 2.0’. There is also a handy toolbar popup labeled
‘Overview’ which allows for setting both the Active SDK and the Build Configuration (typically debug or
release) in one convenient location. If you choose View > Customize Toolbar... you can add this popup to the
toolbar. Many people find this the easiest way to switch SDKs while developing iPhone apps.
Checkpoint: Build and Test
The project is already set up with the skeleton of a Cocoa Touch application. Convince yourself and double
check by clicking the “Build and Go” button in the toolbar. This will build the application and t