Chapter 3. Outlets, Actions, and View Controllers

WHAT YOU WILL LEARN IN THIS CHAPTER

  • How to declare and define outlets

  • How to declare and define actions

  • How to connect outlets and actions to the views in your View window

  • How to add a new View Controller to your application

In the previous chapter, you built a simple Hello World! iPhone application without understanding much of the underlying details of how things work together. In fact, one of the greatest hurdles in learning iPhone programming is the large number of details you need to learn before you can get an application up and running. This book aims to make the iPhone programming experience both fun and bearable. Hence, this chapter starts with the basics of creating an iPhone application. You learn about the various files that make up an iPhone application project, as well as how your code is connected with the graphical widgets you see on an iPhone application.

BASIC CODE AND UI INTERACTIONS

A View-based Application project is a good starting point for developing a single-view application and provides an excellent opportunity for you to understand some of the important concepts in iPhone programming, so that's what you'll work with in this section. You will need to download the code.

To start, launch Xcode and create a new View-based Application project (see Figure 3-1) and name it BasicUI.

Codefile [BasicUI.zip] available for download at Wrox.com

Figure 3.1. Figure 3-1

Xcode displays the list of files in the project (see Figure ...

Get Beginning iPhone® SDK Programming with Objective-C® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.