Book description
Cocoa™ is one of the principal application environments for Mac® OS X. Among Cocoa's many attributes, its advanced object-oriented APIs allow you to develop in both Java and Objective-C. This revolutionary new way of developing sophisticated applications for the Macintosh is both powerful and easy. With Learning Cocoa you'll become familiar with Cocoa application development, using Objective C, not merely by reading, but by doing. The book begins with a discussion of essential object-oriented programming concepts for those with no previous experience. It proceeds through an introduction to the Cocoa environment, development, tools, and some simple tutorials to help you become familiar with the basic elements of Cocoa programming. The remaining tutorials guide you as you create a series of increasingly complex example applications. The techniques and concepts you learn in one tutorial lay the foundation for the more advanced techniques and concepts in the next. You don't need extensive programming experience to complete the examples in this book, though it would be helpful to have some experience with the C programming language. The code for each example is included in the text so you can simply type it in. If you're already familiar with an object-oriented programming language like Java or Smalltalk, you'll quickly feel right at home with Objective-C, the language used throughout this book. As you ease your way into the experience of Cocoa programming, you're encouraged to play, to explore, to "kick the tires." You'll finish this book much better prepared to take on serious application development with Cocoa, and you'll find Apple's development environment not only less mysterious, but one that you'll be eager to program in. Written by insiders at Apple Computer, the book brings you information that you can't get anywhere else--and a potential leg up in the Mac OS X application development market.
Table of contents
-
Learning Cocoa
- Preface
-
I. Cocoa Overview
- 1. Introduction to Cocoa
- 2. Object-Oriented Programming
- 3. Objective-C Primer
- 4. Development Tools
-
II. Single-Window Applications
- 5. Hello World
-
6. Essential Cocoa Paradigms
- Cocoa’s Collection Classes
-
Create Graphical User Interfaces in Cocoa
- Windows in Cocoa
- Nib Files
- Outlets
- Create a Cocoa Application Project
- Open the Main Nib File
- Move and Resize the Window
- Add a Text Field
- Create a Custom Subclass
- Define an Outlet for the Class
- Generate an Instance of the Class
- Connect the Custom Class to the Interface
- Generate the Source Files
- Examine a Header File in Project Builder
- Statically Type the Outlet
- Implement MyController’s awakeFromNib Method
- Build, Debug, and Run Nib Files
- Controls, Cells, and Formatters
-
Target/Action
-
Target/Action Example
- Create the project and user interface
- Create the controller class
- Define the outlets of the class
- Define an action for the class
- Generate an instance of the class
- Connect the interface controls to the class’s actions
- Connect the custom class to the interface
- Generate the source files
- Implement MyController’s action method
- Build and debug the application
-
Target/Action Example
- Object Ownership, Retention, and Disposal
-
7. Currency Converter Tutorial
- Design the Currency Converter Application
- Create the Currency Converter Project
-
Create the Currency Converter Interface
- Open the Main Nib File
- Resize the Window
- Set the Window’s Title and Attributes
- Place a Text Field; Resize and Initialize It
- Duplicate an Object
- Change the Attributes of a Text Field
- Assign Labels to the Fields
- Add a Button to the Interface and Initialize It
- Add a Horizontal Decorative Line
- Aqua Layout and Object Alignment
- Center the Interface Objects and Resize the Window
- Enable Tabbing Between Text Fields
- Test the Interface
- Define the Classes of Currency Converter
- Connect ConverterController to the Interface
- Implement the Classes of Currency Converter
- 8. Event Handling
- 9. Data Functionality
-
10. Travel Advisor Tutorial
- Travel Advisor Design
-
Create the Travel Advisor Interface
- Get Started
- Create the Application Project
- Customize the Application Window
- Add the Text Fields, Labels, and Buttons to the Window
- Add a Form Object to the Interface
- Group the Objects on the Interface
- Add the Text View
- Add and Configure the Table View
- Add an Image to the Interface
- Add a Menu and Menu Items
- Add Formatters
- Make Connections for InterfieldTabbing and Printing
- Test the Interface
-
Define the Classes of Travel Advisor
- Specify the Country and TAController Classes
- Specify TAController’s Outlets and Actions
- Reuse the Converter Class
- Generate TAController and Converter Instances
- Make Connections to the TAController Instance
- View Connections in Outline Mode
- About File’s Owner
- Connect the Delegate Outlet
- Generate Source Code Files
-
Implement the Classes of Travel Advisor
- Reuse Currency Converter
- Build and Test the Application
- Implement Temperature Conversion
- Implement the Country Class
- Statically Type TAController’s Outlets
- Add New Instance Variables to TAController.h
- Implement the blankFields: Method
- TAController and Data Mediation
- Get the Table View to Work
- Build the Project
- Add and Delete Records
- Field Validation
- Application Management
- Implement Archiving and Unarchiving
- Build and Run the Application
-
III. Multiple-Window Applications
- 11. Cocoa’s Multiple-Document Architecture
-
12. To Do: Basics
- The Design of To Do
-
Build the Application
- Create the Project
- Rename the NSDocument Subclass
- Create the Model Class (ToDoItem)
-
Implement the Calendar view
- Matrix as superclass
- Compose the interface
- Add declarations to the header file
- Declare CalendarMatrix’s private methods
- Implement initWithFrame: and dealloc
- Implement awakeFromNib
- Implement refreshCalendar
- Implement highlightTodayIfVisible
- Implement the choseDay: action method
- Implement the monthChanged: action method
- Build and test
- Complete the Document Interface
-
Manage To Do’s Data and Coordinate Its Display
- Declare ToDoDocument’s private methods
- Modify windowControllerDidLoadNib:
- Implement initDataModelWithDictionary:
- Implement the currentItems accessor methods
- Implement updateLists:
- Implement saveDocItems:
- Implement selectItemAtRow:
- Implement controlTextDidBeginEditing:
- Implement controlTextDidEndEditing:
- Update the CalendarMatrix delegate method
- Build and test
-
13. To Do: Extended
-
Create and Manage an Info Window
- Customize the Application’s Menu
- Create and Configure an Application Delegate
- Create a nib File for To Do’s Info Window
- Create an Offscreen Panel
- Apply Formatters
- Define the InfoWindowController Class
- Type Outlets
- Add Declarations to InfoWindowController.h
- Implement Basic Methods
- Build and Test
- Implement Advanced InfoWindowController Methods
- Create SelectionNotifyMatrix
- Data Synchronization
- Create a Custom View to Display ToDoItem Status
- Set Up Timers
- Implement Archiving and Unarchiving (Save and Open)
-
Create and Manage an Info Window
- 14. To Do: Finishing Touches
- IV. Reference
- Index
- Colophon
Product information
- Title: Learning Cocoa
- Author(s):
- Release date: May 2001
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9780596001605
You might also like
video
Learning Cocoa
Learn how use Cocoa with Objective-C to develop applications on the iOS and OS X platforms. …
book
Learning Cocoa with Objective-C, 2nd Edition
Learning Cocoa with Objective-C is the "must-have" book for people who want to develop applications for …
book
Learning Cocoa with Objective-C, 4th Edition
Get up to speed on Cocoa and Objective-C, and start developing applications on the iOS and …
book
Cocoa and Objective-C: Up and Running
Build solid applications for Mac OS X, iPhone, and iPod Touch, regardless of whether you have …