Getting Started with iPhone Development

We recently released a new set of iPhone 3.0 developer examples as free, downloadable Xcode projects. If you’re new to the iPhone SDK, or you’re trying to learn the basics of Core Animation, or the details of how to work with UITableView and UINavigationController, these are a great place to start. (You can download the examples here.)

These projects are designed as a progressive series that start with the rudiments of iPhone programming and gradually work their way up through the development of a fairly sophisticated productivity app. The examples concentrate on showing how to do things programatically — there are no .nib files in the projects.

We’re planning to release a corresponding set of .nib-based examples later this summer that will demonstrate how to develop the same apps using Interface Builder. It’s going to take a little longer to get them ready because of the extra writing required to adequately explain how things are connected, and exactly what Interface Builder is doing. IB is pretty mystical for developers who aren’t familiar with it, and there’s just too much of that magic going on for the examples to make sense with just code comments (which is primarily how the current set is documented).

Anyway, here’s an overview of the initial set of examples:

First App demonstrates the basic steps to configuring an iPhone app’s user interface programatically, without requiring an Interface Builder (.nib) file.

Editable Detail View demonstrates the use of controls such as text fields and buttons, including how to connect controls to the code that implements their behavior.

Animating a View introduces developers to the fundamentals of using Core Animation to animate view transformations.

Simple TableView demonstrates how to configure a table view programatically to present a list of values.

TableView with Navigation builds on the Simple TableView app to show how to use a navigation controller to manage navigating from a list to a detail view by tapping on a table row.

Editable TableView demonstrates how to add, remove, and reorder rows in a list view, and how to edit model object property values in a detail view.

TableView File Persistence shows how to create and populate a list of model objects from a property list (plist) file, and how to persist changes to the list.


4 comments so far

  1. Mike on

    Hi, just wanted to ask, I downloaded the TableView with Navigation app, and when I did ‘Build and Go’, it gave me 8 errors and 1 fail. It seems to be a problem with ‘ reuseIdentifier:@”MyCell” ‘ Is there anyway I can fix this?

    I myself am not a programmer, so I’m very new to all this. I’m trying to build a simple app that takes saved addresses and loads them into the directions section of the Map application. I was going to try and combine the TableView with Navigation part with some other application I can find that has the directions section of the Map application….any suggestions?

    Thanks for the help in advance – I really appreciate the work you’ve put into this site.


    • jonathanlehr on

      Hi Mike,

      The first thing to check is the drop down menu on the upper left side of Xcode’s toolbar (it’s labeled overview). You need to make sure that it’s set to Simulator – iPhone OS 3.0 (or higher). I’m guessing the compiler errors you’re seeing are a result of trying to compile the newer UITableView APIs against one of the older (pre-3.0) versions of the framework.

  2. Osvaldo on

    Hi there i have been looking all over the internet on how to Animating a View and i found it the problem now is when i put the repeat function the view goes away but then it appears again and i want it away.

    • Jonathan Lehr on

      Core Animation works by creating something similar to a movie of a view gradually changing from a starting state to an end state. When you make a change to one or more animatable properties of a view within an animation block, Core Animation creates this ‘movie’ and plays it in a separate thread as soon as you commit the animations.

      Since what triggered the animation is a change to the view’s state, once the ‘movie’ stops playing, the view is in whatever state you changed it to. So for example, if you changed the view’s center property, the view will actually recenter itself at the new x, y coordinates, even if you configured the animation to autoreverse so that the animation finishes at the view’s starting position. In this case, the view will appear to ‘jump’ from the starting location to the ending location at the end of the animation.

      You could use any of the above techniques to smoothly animate the view moving to its ending position after the first animation block completes. For relatively simple animations, you may be able to get the desired effect by simply providing a fractional value (e.g., 1.5 for one and a half times) for the repeat count.

      If you need something additional to happen after the animation plays, you can create another animation block and trigger it one of several ways: using a delayed perform (see the NSObject class’s -performSelector:withObject:afterDelay: method); using an instance of NSTimer, or by setting an animation delegate and an animation callback method (see the UIView class’s -setAnimationDelegate: and -setAnimationDidStopSelector: methods).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: