27
Your First iOS Application

In this chapter, you are going to create an iOS application: a simple to-do list application called iTahDoodle that stores its data as a property list. Here’s what iTahDoodle will look like when you’re done.

Figure 27.1  Complete iTahDoodle application

Complete iTahDoodle application

All iOS applications are event-driven applications. The run loop waits for events. The waiting application then responds to events generated by the user (like a button tap) or the system (like a low-memory warning).

Getting started with iTahDoodle

In Xcode, choose FileNewNew Project.... Under the iOS section (not the Mac OS X section), click on Application. From the template choices that appear, select Empty Application.

Figure 27.2  Creating a new iOS Application

Creating a new iOS Application

Xcode’s project templates exist to make your job easier. They contain boilerplate code that can speed up development. However, here we intentionally choose the Empty Application template, which is as close to a blank template as you can get. Allowing Xcode to generate too much boilerplate code at this point gets in the way of your learning how things work.

In addition, the names of these templates often change with new Xcode releases, so don’t worry if the templates you see don’t exactly match Figure 27.2. Look for the simplest-sounding template and then make changes to align your code with the book’s code. If you have trouble reconciling your code or project templates, visit the Big Nerd Ranch forum for this book at forums.bignerdranch.com for help.

After choosing the Empty Application template, click Next and name this project iTahDoodle. The Company Identifier and Bundle Identifier are related to keeping each app on the App Store unique. Both are strings in reverse-domain notation. Big Nerd Ranch uses com.bignerdranch as its Company Identifier.

Figure 27.3  Configuring the iTahDoodle project

Configuring the iTahDoodle project

Whatever you enter as the Class Prefix will be prepended to the name of the initial class that the template creates for you. This two- or three-letter prefix will keep your class names distinct from Apple’s or anyone else’s. (Use BNR for now to keep our code in sync.)

Notice that Apple’s code includes prefixes. All of Apple’s classes that you’ve seen so far begin with the prefix NS, which stands for NeXTSTEP, the platform for which the Foundation framework was originally designed. In this chapter, you’ll also use classes from the UIKit framework, and they will begin with UI.

Finally, make iTahDoodle an iPhone (as opposed to iPad or Universal) application. iTahDoodle will use Automatic Reference Counting but not use Core Data or unit tests.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset