|
Write your own iPhone apps for fun and profit |
|
|
by David M Williams
|
|
Wednesday, 09 July 2008 |
|
Page 3 of 4 The starting iPhone app templates you can choose from start with a navigation-based application - that is, an app with a forwards and backwards control. The template gives you a pre-created user interface with the navigation controls and a table to display a list of items. Another is a tab bar application which provides a user interface configured with a tab controller, and a view controller to implement the first tab.
One I like is the utility application template; this provides the starting point for a utility with both a main view and a flipside view. You might use this for a program that, say, lets you plan out a dinner party. On one screen you specify the meals you want to cook. Flip the screen and see a list of all the combined raw ingredients for your shopping plans. Or, perhaps you may have a single screen utility but the “About” button flips around to show your smiling face as the program author.
It’s not all work; the OpenGL ES Application template gives you a kick start for writing games. This time the pre-created code provides a screen for you to work with and a timer. You’re expected to draw the screen and then refresh it every time the timer counts down to zero, thus providing animation.
Of course, you can forget what Apple give you. Another template is not really a template at all; it allows you to construct a totally blank application so you can begin from scratch.
For the moment, lets pick the Utility Application. Click on it and press the Choose button. You’ll be prompted for the name of the app and where to save its files. Xcode then goes ahead and creates a bunch of source code files. There are quite a few, but you’ll find they are organised in the left-hand pane into meaningful groups. The user interface layouts are down the bottom (with .xib file extensions.) Double-click on one and the Xcode interface builder opens up, allowing you to make up a screen.
The first thing you ought to do here is click the Tools/Library window. This displays the available controls and components you can drag and drop onto the screen you are making. It is very easy to get the hang of this; just click on a search box, for instance, or a tab control or an on/off switch and drag it over onto the screen.
What’s more complex are the program code files. Let me tell you, then we'll actually fire up an iPhone replica!
CONTINUED
|