Book description
Cocoa is an object-oriented development environment available in Apple's Mac OS X environment. Mac OS X, a unified operating system and graphical operating environment, is the fastest growing Unix variant on the market today. Hard-core Unix programmers, developers who cut their teeth on classic Mac operating systems, and developers who cherished NeXTSTEP, the decade-old system on which today's Cocoa is based -- all are flocking to Cocoa, and they need a lot more practical information than is currently available from Apple. There is a lot to learn. Building Cocoa Applications is an ideal book for serious developers who want to write programs for the Mac OS X using Cocoa. It's a no-nonsense, hands-on text that's filled with examples -- not only simple and self-contained examples of individual Cocoa features, but extended examples of complete applications with enough sophistication and complexity that readers can put them to immediate use in their own environments. Building Cocoa Applications takes a step-by-step approach to teaching developers how to build real graphics applications using Cocoa. By showing the basics of an application in one chapter and then layering additional functionality onto that application in subsequent chapters, the book keeps readers interested and motivated. Readers will see immediate results, and then go on to build onto what they've already achieved. The book is divided into four major parts: Part I introduces the Mac OS X graphical user interface (Aqua) from a developer's point of view, Cocoa developer tools (such as the Interface Builder, Project Builder, and gdb debugger), object-oriented concepts, the Objective-C language in which Cocoa is written, and the basics of Cocoa programming itself. Part II focuses on building the first complete application, Calculator, a simple four-function calculator. The chapters in this part of the book extend the application, piece by piece, by introducing such features as nibs, icons, delegation, resizing, events, and responders. Part III focuses on building an application called MathPaper, which is similar to a word processor but which instead solves mathematical expressions the user supplies. The chapters in this part of the book extend MathPaper by developing both the front and back ends using a variety of Cocoa classes and methods. They introduce Cocoa'sdocument-based architecture, tasks, pipes, Rich Text format, handling document files, and using Quartz to draw in windows. Part IV focuses on building the GraphPaper application, a more complex multithreading application that graphs mathematical functions in multiple dimensions and that uses mouse-over capabilities to identify graph points. The chapters in this part of the book add more advanced Mac OS X features such as multithreading, color, mouse events, zoom buttons, pasteboards, services, preferences, and the defaults database. By the end of the book, readers who have built the applications as they have read will have a solid understanding of what it really means to develop complete and incrementally more complex Cocoa applications. The book comes with extensive source code available for download from the O'Reilly web site, along with an appendix listing additional resources for further study.
Table of contents
-
Building Cocoa Applications: A Step-by-Step Guide
- Preface
-
I. Cocoa Overview
-
1. Understanding theAqua Interface
- What Makes Mac OS X So Special?
- A Quick Look at the Mac OS X User Interface
- Basic Principles of the Aqua Interface
- The Mouse and Cursor
- Window Types and Behavior
- Menus and the Menu Bar
- The Dock
- Controls
- The Finder
- Configuring Your Desktop, Step by Step
- Menu Guidelines and Keyboard Equivalents
- Working with the Filesystem,Step by Step
- Summary
- Exercises
- References
- 2. Tools for Developing Cocoa Applications
- 3. Creating a Simple Application with Interface Builder
-
4. An Objective-C ApplicationWithout Interface Builder
- The Tiny.m Program
-
An Introduction to Objective-C
- Objects and Classes
- Methods and Messaging
- The id Data Type
- A Simple Class Example
- Creating and Initializing Objects
- The @interface Directive
- The #import Directive
- Destroying Objects
- The @implementation Directive
- The +alloc Method and the NSObject Root Class
- NSString, NSMutableString, and NSLog
- autorelease and the NSAutoreleasePool Class
- Tiny.m Revisited
- Summary
- Exercises
- References
-
1. Understanding theAqua Interface
-
II. Calculator: Building a Simple Application
-
5. Building a Project: A Four-Function Calculator
- Getting Started: Building the Calculator Project
- Building the Calculator’s User Interface
- Building the Calculator’s Controller Class
- Customizing Buttons and Making Connections
- Compiling and Running a Program
- Compiler Error Messages
- The enterDigit: Action Method
- Adding the Four Calculator Functions
- Adding the Unary Minus Function to the Controller Class
- The Files in a Project
- Summary
- Exercises
- 6. Nibs and Icons
- 7. Delegation and Resizing
- 8. Events and Responders
- 9. Darwin and the Window Server
-
5. Building a Project: A Four-Function Calculator
-
III. MathPaper: A Multiple-Document, Multiprocess Application
- 10. MathPaper and Cocoa’sDocument-Based Architecture
- 11. Tasks, Pipes, and NSTextView
- 12. Rich Text Format and NSText
- 13. Saving, Loading, and Printing
- 14. Drawing with Quartz
- 15. Drawing in a Rectangle: More Fun with Cocoa Views
-
IV. GraphPaper: A Multithreaded, Mouse-Tracking Application
-
16. GraphPaper: A Multithreaded Application with a Display List
- GraphPaper’s Design
- Working with Multiple Threads
-
Building the GraphPaper Application
- Changes to the Evaluator Back End
- Building GraphPaper’s Interface
- The GraphView Class Interface File
- The GraphView Class Implementation File
- The initWithFrame: Method
- Implementing the Display List
- Scaling the GraphView and the drawRect: Method
- The Data Stuffer Methods
- Stopping a Running Graph
- The Graph Displayer
- The Segment Class
- Testing GraphPaper
- Extending the Display List
- Summary
- Exercises
- References
-
17. Color
- Colors and Color Objects
-
Adding Color to GraphPaper
- Creating a Preferences Panel
- The Controller Class
- Creating the Preferences Nib, Panel, and PrefController
- PrefController Class Implementation
- ColorGraphView
- The ColorGraphView Class Implementation
- Setting the Colors
- Setting the Initial Color
- The GraphView, Segment, and Label Classes
- Testing GraphPaper’s Color
- Summary
- Exercises
- 18. Tracking the Mouse
- 19. Zooming and Saving Graphics Files
- 20. Pasteboards, Services, Modal Sessions, and Drag-and-Drop
- 21. Preferences and Defaults
-
16. GraphPaper: A Multithreaded Application with a Display List
- A. Cocoa Resources
- Index
- Colophon
Product information
- Title: Building Cocoa Applications: A Step by Step Guide
- Author(s):
- Release date: May 2002
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9780596002350
You might also like
book
Swift Development with Cocoa
Ready to build apps for iPhone, iPad, and Mac now that Swift has landed? If you’re …
video
Learning Cocoa
Learn how use Cocoa with Objective-C to develop applications on the iOS and OS X platforms. …
book
Learning Cocoa
Cocoa™ is one of the principal application environments for Mac® OS X. Among Cocoa's many attributes, …
book
Cocoa and Objective-C: Up and Running
Build solid applications for Mac OS X, iPhone, and iPod Touch, regardless of whether you have …