Main Content

iPad and iPhone programming - our seminar weekend with Xcode

Archive - Originally posted on "The Horse's Mouth" - 2012-03-11 09:06:29 - Graham Ellis

Seeing the wood for the trees ... that's one of the major issues when you come to writing apps for the iPad and iPhone for the first time. And yesterday, Kyle, Elliot and myself sat down at a couple of Macs and came up with a demonstration first app from first principles.

There's lots of decisions to make as you enter the Xcode environment and set up your first application - we went for single view, automatic reference counting, no GIT repository, and a few other options ... then jumped into editing the code of the resultant ViewController. Our header file is [here] and our Objective C source file is [here].

Basic changes to the template? In the header file, we define the elements of the UIViewController, properties for GUI elements we want to change programatically, and Action templates for GUI element actions.

In the main source file, we synthisize methods for each of the objects we want to control, and we provide the action code.

The look and feel is laid our graphically in Xcode - here's a sample screen showing the completed layout with some of the menus. The file that we generated - known as a "nib" file but with a .xib extension (as it's XML) is [here].


Running the app (through the simulator)










We've already solved a few of the issues that are common problems on iPad and iPhone development for newcomers - such as "how do I get rid of the keyboard", and "what is an action and an outlet" ... much more to come today. We've opened Pandora's box and are about to look further inside.