PDF Ebook Cocoa Application Tutorial

Submitted by antoq on Sun, 08/30/2009 - 01:23

This document introduces the Cocoa application environment using the Objective-C language and teaches you how to use the Xcode Tools development suite to build robust, object-oriented applications. Cocoa provides the best way to build modern, multimedia-rich, object-oriented applications for consumers and enterprise customers alike. This document assumes you are familiar with C programming but does not assume you have previous experience with Cocoa or Xcode Tools.

This chapter covers the most common object-oriented design pattern used in Cocoa and shows how that paradigm is applied to application development. A design pattern is a template for a design that solves a general, recurring problem in a particular context. If you have done object-oriented design before, you may be wondering how that model fits into the world of Cocoa. This tutorial will help you understand what Cocoa is as an object-oriented framework. If you’ve done only procedural programming before, don’t worry. This tutorial also teaches the basics of the object-oriented programming. You will learn the MVC design pattern, which is a very common practice used by application developers.

Contents
Introduction

    Introduction to Cocoa Application Tutorial
    Organization of This Document
    Goals for Learning
    Prerequisites
    See Also

Chapter 1
The Essence of Cocoa

    What Is Cocoa?
    Classes and Objects
    The MVC Design Pattern
      Model Objects
      View Objects
      Controller Objects
      Hybrid Models

    The Currency Converter Application

Chapter 2
Creating a Project in Xcode

    Open Xcode
    Make a New Project
      Choose the New Project Command
      Choose a Project Type
      The Xcode Project Interface
      What’s Next?

Chapter 3
Defining the Model

    Specify the Model Class
    Declare the Model Interface
      Declare Member Variables
      Declared Properties and Accessor Methods
      Declare the Model Method: convertCurrency

    Implementing the Model

      Define the convertCurrency Method

    What’s Next?

Chapter 4
Defining the View: Building the User Interface

    User Interface Elements and Interface Builder
      What Is a Nib File?
      Windows and Menus in Cocoa

    Creating the Currency Converter Window

      Create the Window
      Resize the Window
      Change the Title of the Window
      Add the Text Fields
      Assign Labels to the Fields
      Change the Text Field Attributes
      Configure a Button
      Add a Separator to Group Controls

    Refining the Layout and View Functionality

      Configure the Menu
      Aligning Objects in a Window
      Finalize the Window Size
      Enable Tabbing Between Text Fields
      Set the First Responder Text Field

    Test the Interface
    What’s Next?

Chapter 5
Bridging the Model and View: The Controller

    Paths for Object Communication: Outlets, Targets, and Actions
      Outlets
      Target/Action in Interface Builder
      Which Direction to Connect?

    Defining the Controller Class
    Defining the Outlets for the ConverterController Class
    Implementing the Controller Method: convert:
    Interconnecting the Controller with the View

      Add the ConverterController Class to Your Nib File
      Connect the ConverterController Instance to the Text Fields
      Connect the Convert Button to the Appropriate Methods
      Check Your Work

    Connecting the Controller with the Model
    Garbage Collection
    What’s Next?

Chapter 6
Building and Running Your Application

    Build the Application
      Extra: Check Out the Look Up Documentation

    Run the Application
    Correct Build Errors
    Great Job!
    What’s Next?

Chapter 6
Configuring Your Application

    The Info.plist File
    Basic Project Attributes
    Specify the Identifier, Version, and Copyright Information
    Create an Icon File
    What’s Next?

Chapter Chapter 7
Configuring Your Application

    The Info.plist File
    Basic Project Attributes
    Specify the Identifier, Version, and Copyright Information
    Create an Icon File
    What’s Next?

Chapter 8
Expanding on the Basics

    For Free with Cocoa
      Application and Window Behavior
      Controls and Text
      Menu Commands
      Document Management
      File Management
      Communicating with Other Applications
      Custom Drawing and Animation
      Internationalization
      Editing Support
      Printing
      Help
      Plug-in Architecture

    Turbo Coding with Xcode

      Project Find
      Code Sense and Code Completion
      Integrated Documentation Viewing
      Indentation
      Delimiter Checking
      Emacs Bindings

Appendix A
Objective-C Quick Reference Guide

    Messages and Method Implementations
    Declarations

Document Revision History

Download
PDF Ebook Cocoa Application Tutorial


Posted in :