Apress

Learn Cocoa on the Mac

By Jack Nutting , David Mark , Jeff LaMarche

Learn Cocoa on the Mac Cover Image

This book helps you find your way through the jungle of classes, tools, and new concepts so that you can get started on the next great Mac OS X application today.

Full Description

  • ISBN13: 978-1-4302-1859-3
  • User Level: Beginner to Intermediate
  • Publication Date: March 4, 2010
  • Available eBook Formats: PDF
  • Print Book Price: $39.99
  • eBook Price: $27.99
Buy eBook Buy Print Book Add to Wishlist

Related Titles

Full Description

The Cocoa frameworks are some of the most powerful frameworks for creating native desktop applications available on any platform today, and Apple gives them away, along with the Xcode development environment, for free! However, for a first-time Mac developer, just firing up Xcode and starting to browse the documentation can be a daunting task. The Objective-C class reference documentation alone would fill thousands of printed pages, not to mention all the other tutorials and guides included with Xcode. Where do you start? Which classes are you going to need to use? How do you use Xcode and the rest of the tools?

This book answers these questions and more, helping you find your way through the jungle of classes, tools, and new concepts so that you can get started on the next great Mac OS X application today. Jack Nutting is your guide through this forest; he's lived here for years, and he'll show you which boulder to push, which vine to chop, and which stream to float across in order to make it through. You will learn not only how to use the components of this rich framework, but also which of them fit together, and why.

Jack Nutting’s approach, combining pragmatic problem-solving with a deep respect for the underlying design philosophies contained within Cocoa, stems from years of experience using these frameworks. He’ll show you which parts of your application require you to jump in and code a solution, and which parts are best served by letting Cocoa take you where it wants you to go. The path over what looks like a mountain of components and APIs has never been more thoroughly prepared for your travels. With Jack’s guidance, the steep learning curve becomes a pleasurable adventure. There is still much work for the uninitiated, but by the time you’re done, you will be well on your way to becoming a Cocoa master.

What you’ll learn

  • How to actually make your own Cocoa applications—this is much more than just a quick introduction to Cocoa!
  • Which classes, of the dozens included in Cocoa, are truly central to Cocoa development
  • How to best use MVC architecture concepts in a Cocoa application
  • How the various pieces of the Cocoa frameworks fit with each other and into the MVC architecture
  • Which parts of Cocoa truly enable “visual programming”, letting you reap the benefits of proven, reusable code libraries that Apple gives you for free
  • How to recognize recurring design patterns used throughout Cocoa, and put them to proper use in your own code
  • How to approach Cocoa from different programming environments
  • How to use the facilities provided in Snow Leopard to create software that distributes itself automatically among all available CPUs, improving the user experience for your users.

Who this book is for

Anyone with basic understanding of object-oriented programming who wants to try out Mac OS X application programming, as well as iPhone developers who want to extend their knowledge of Cocoa touch to include the Mac-specific technologies included with Cocoa.

Table of Contents

Table of Contents

  1. Must Love Cocoa
  2. Hello, World
  3. Lights, Camera... Actions! (and Outlets, Too) 
  4. GUI Components
  5. Using Table Views
  6. Cocoa Bindings
  7. Core Data Basics
  8. Core Data Relationships
  9. Search and Retrieve Core Data with Criteria 
  10. Windows and Menus and Sheets
  11. Document-Based Applications
  12. Exceptions, Signals, Errors, and Debugging
  13. Drawing in Cocoa
  14. Advanced Drawing Topics
  15. Working with Files
  16. Concurrency
  17. Future Paths
Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.

Errata

If you think that you've found an error in this book, please let us know about it. You will find any confirmed erratum below, so you can check if your concern has already been addressed.

* Required Fields

On page 102-103:
p102 + others : [...byExtendingSelection: ] is deprecated in 10.3

p103 after Section1 code ..

int selectedRow
should be NSInteger selectedRow

On page 122:

With XCode 4.1 (for Lion) the example doesn't work. The problem is in the init method: i replace
"characters = [NSMutableArray array];"
with
"characters = [[NSMutableArray alloc] init];"
and it works!

With your code i obtain this error:
"DungeonThing(863,0x7fff7c69d960) malloc: *** error for object 0x10040dc00: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug"

On page 260:

The end of the first paragraph states that "one unit along either axis corresponds to one screen pixel".

I believe this to be incorrect as Apple's Cocoa Drawing Guide (2011-01-18) states on page 41 "Units in the user space are based on the printer's point...Although a single point often corresponded directly to a pixel in the past, in Mac OS X, that may not be the case".