I’m teaching a year long iPhone programming class to middle school students. The only prerequisite for the class is one year of programming. Some of them have worked with Actionscript, Processing and Arduino. Others only have experience with Revolution.
I’ve tried to prepare the kids for the work that is involved. I’ve told them that graduate students at ITP were told that their iPhone programming class was going to be harder than any other programming class they’ve taken. In spite of my warnings, no one was scared off.
To get the ball rolling without talking about Objective-C, students worked on 2 simple applications. The first one, which is included below, is your basic Hello World app. In addition to creating a label, students also got to create their own icons for their applications.
The second application was a View-Based Application that modified the code in the implementation file so that the content could turn when the device is turned.
Everyone in the class completed the first part. There were two students that were confused about what a .png was and renamed their photoshop images with the .png extensions. After struggling to get their icons to show up, I’m pretty sure they won’t make that mistake again!
Overall, everyone was engaged and the energy level was high. Not bad for the last class of the day.
Hello World
xib files used to be called nib files and Apple continues to refer to them as nib files regardless of their extention.
Nib files are composed of several parts
- File’s Owner
- First Reponder
- View—instance of UIView class
Part 1
- Open Xcode and create a new project (⌘+ ⇧+N)
- Select application under the iPhone icon on the left
- In the right panel select Window-Based Application, then press Choose. Save the project
- Double-click on the nib file to open
Interface Builder
- Open Library (⌘+⇧+L)
- Scroll down until you see a label icon.
- Drag from library to view
- Open Inspector (⌘+ ⇧+I)
- Modify label so that you pick a size, color, drop shadow and a message.
- Save
- In Xcode click on Build and Run
Interface Builder creates Objective-C objects and serializes those objects in to the nib file so that they can be loaded directly into memory at runtime.
Make sure that if you have an iPhone, your actual iPhone is not plugged into the computer while developing iPhone applications.

Part 2
- Open your last project in the Simulator
- Click on the Home Icon
- Look at your application icon
- You need to create a .png icon 57 x 57 pixels. In Photoshop create your icon. Don’t worry about applying the button effect to it, it will happen automatically. Save it as icon.png
- Select the Resources folder and choose Add to Project from the Project menu and navigate to the icon. Choose Copy items into destination group’s folder(if needed).
- In Xcode expand the Resources folder. Click once on Info.plist. This property list contains general information about the application you are building, including the name of the icon file.
- Find the row with the label Icon file. Double click on the empty cell to the right of the label and type in the name of your png file
- Locate Bundle identifier. The standard naming convention is to use com or org followed by a period, then the name of the organization, another period and the name of the application.
- compile and run
![]()
Clearing out old icons
Under iPhone Simulator menu select Reset Content and Settings:![]()