oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
Programming With Cocoa

The Cocoa programming environment is used to create native Mac OS X applications. Mac DevCenter features a variety of tutorials covering Cocoa. If you're just getting started and don't have an extensive background in "C," then start with Seth Roby's "C is for Cocoa" tutorial. As you become more comfortable in this environment, try some of Mike Beam's more advanced lessons. New tutorials are constantly being added, so be sure to check back regularly.
Atom feed for this author. RSS 1.0 feed for this author. RSS 2.0 feed for this author.

Understanding the NSTableView Class
This article will provide you with an in-depth introduction on how to use the NSTableView Cocoa class to display tabular data. You will first learn how to add an instance of that class to your application project using Interface Builder. Then, you will learn how to properly implement the data-source process used to retrieve the data to be displayed by the instantiated table. Jose Cruz shows you how. Aug. 8, 2006

Inside StYNCies, Part 2
In the first part of this two-part series, Matthew Russell showed you how to develop a user interface that lives up in your menubar like the system clock. In this final installment, he covers how to reverse-engineer the storage format of the StickiesDatabase file to develop your own API to Stickies.  Mar. 18, 2005

Inside StYNCies
Stickies is one of the handiest little apps out there. It's been bundled with Apple's operating systems for ages, but Apple hasn't yet taken advantage of the new possibilities for it. This first installment of a two-part series works through building a partial implementation of StYNCies, a neat little utility that synchronizes your Stickies to your iPod and/or iDisk. Mar. 11, 2005

Build an eDoc Reader for Your iPod, Part 3
In this conclusion to the series on building your eDoc reader, Matthew Russell shows you how to extract text from PDF documents. You'll accomplish this task by using an open source Java package called PDFBox and the not-so-well documented Cocoa-Java bridge. Jan. 7, 2005

Build an eDoc Reader for your iPod, Part 2
This second part of a trilogy teaches you how to make reading electronic documents on your iPod easy. Matthew Russell delves into the engine of the application and adds some user interface conveniences through NSUserDefaultsDec. 17, 2004

Build an eDoc Reader for your iPod
Wouldn't you like to read large text documents, PDF files, and other eDocs on your 3G iPod (or newer)? In this first part of a three-part series, Matthew Russell shows you how using Xcode. Dec. 14, 2004

Making Cocoa-Java Apps Scriptable
In this article, Mike Butler provides tips and examples for implementing an AppleScript interface in a Cocoa-Java-based application. Believe it or not, after a few exercises, you'll see that it works just as you would expect it to.  Oct. 22, 2004

An Introduction to RubyCocoa, Part 2
In Part 1 of this two-part series, Christopher Roach provided some background and helped you get started with RubyCocoa programming. In today's conclusion he gets into the actual code ... and if you're following along, you'll end up with a functioning application. Oct. 12, 2004

An Introduction to RubyCocoa, Part 1
RubyCocoa is a framework that provides a bridge between the Ruby programming language and the Cocoa framework. In this tutorial, Christopher Roach shows you how to use this tool by walking you through the steps for creating a simple GUI for the Unix tar program. Oct. 5, 2004

Easy Code Documentation with Xcode
As a developer, you must not only use documentation but also provide it for your own code if you want to make it usable to others. Providing up-to-date and easy-to-navigate API documentation is a big step toward making your code accessible and useful. If you are a Mac developer, you can leverage the power of Xcode so that it requires minimal effort to create good documentation. Adam Behringer shows you how. Aug. 27, 2004

Higher-Order Messages in Cocoa
Higher-Order Messaging (HOM) refers to the treatment of a message as a data type, like an object, so that it can be used as the argument in another message. The grandest use of them by far is for fun uses of arrays; combining them, getting selections from them, and so forth. But they also have uses in exception handling. Rob Rix explains HOM in this tutorial. Jul. 16, 2004

BYOB: Build Your Own Browser, Part 3
In part two of this series, Andrew Anderson showed you how to enhance your basic browser with multi-window capabilities. Here, he tackles adding a preferences window and a content eliminator. Jun. 4, 2004

BYOB: Build Your Own Browser, Part 2
In part one Andrew Anderson showed you how to get your hands dirty with WebKit. Now in Part 2 he goes beyond the basics showing you how to enhance your basic browser with multi-window capabilities, a preference window, and a content eliminator. May. 28, 2004

Integrating Xgrid into Cocoa Applications, Part 2
Last week in Part 1, Drew McCormack showed you how to install and start using Xgrid. Now in Part 2, he covers integration with Cocoa using a little program called Photo Industry. This will be an Xgrid-enabled app, and what's more, it will be a standalone app, not an Xgrid client plugin. May. 18, 2004

Integrating Xgrid into Cocoa Applications, Part 1
In this first of two articles exploring Xgrid, Drew McCormack provides you with a little background information, then moves to installation, and finishes off with a command-line script for distributing compilation using Xgrid. May. 11, 2004

The Cocoa Controller Layer
The controller layer is the confluence of several new and existing Cocoa technologies, including key-value coding, key-value observing, and key-value binding. In this tutorial, Mike Beam returns for a guest appearance to discuss NSController. Apr. 6, 2004

BYOB: Build Your Own Browser
WebKit is a fully functional set of web browsing components that developers can integrate into their Cocoa/Carbon applications. Andrew Anderson shows you how to get your hands dirty with this easy-to-use API. Jan. 23, 2004

Learning Cocoa: Repurposing Variables
You can massage your variable string in many different ways: you can print it, change its contents, reconstruct it, and lots of other things to mutate it from one state into another. Seth Roby shows you some handy ways to get more from your variables when programming in Cocoa. Jan. 13, 2004

Ten Things I Dig About Xcode
Following in the footsteps of "Ten Things I Dig About Panther," James Duncan Davidson further explores one of the facets near and dear to Mac developers--their application development environment. Apple is introducing Xcode, along with Panther, and Davidson takes it for a spin and reports on his initial findings. Oct. 24, 2003

The Double Life of Variables
The most basic duality that exists with variables is how the programmer sees them in a totally different way than the computer. When you're typing away in Project Builder, your variables are normal words smashed together, like software titles from the 80s. But when the machine compiles your code, however, it does a little bit of translation. At run time , the computer sees nothing but 1s and 0s. Seth Roby introduces you to this double life of variables. Oct. 7, 2003

Loop the Loop
No longer will our Cocoa programs be forced to merely plow through line after line of code, skipping comments and blocks in conditionals, never looking back. In lesson #4, we'll teach our programs how to jump around a bit, to take their time and enjoy the code we've written, to evaluate those lines a few times over. In this lesson, we'll examine the loop. Sep. 9, 2003

Go with the Flow
In the last tutorial in Seth Roby's ongoing Cocoa series, you learned the ins and outs of the role of functions in programming. In this third installement he tackles the notion of "the flow of control." Aug. 19, 2003

What's Your Function?
Basically, a function is a bit of code that you want to use over and over again. It does a little bit of work that you can change slightly by passing it different arguments. In this second tutorial in Seth Roby's ongoing Cocoa series, you'll learn the ins and outs of the role of functions in this type of programming. Aug. 1, 2003

C is for Cocoa
The debut of a new Cocoa series on Mac DevCenter. Unlike other articles you've worked with, this tutorial teaches you all the C you need to know to learn Cocoa, and ignores the rest. These lessons will leave out the parts of C that, while useful, are not necessary to know in everyday Cocoa programming. Jul. 22, 2003

Networking in Cocoa
Now that he's returned from his book writing hiatus, Mike Beam shows you how to finish off the RCE chat program he started several columns ago. May. 13, 2003

Networking and the BSD Sockets API
Mac OS X is a wonderful platform for learning about networking, since it has such a rich set of APIs to offer -- in particular, the venerable BSD sockets API. In this article, you'll learn about this API, and in doing so, you'll write a tiny pair of C applications that demonstrate how clients and servers can be configured to talk to one another. Dec. 27, 2002

Incorporating Rendezvous into Your Cocoa Applications, Part 2
In Part 1 of this series, Mike Beam explained how ZeroConf networking provides solutions to addressing, naming, and service discovery hurdles. Now in Part 2, you roll up your sleeves and build your own iChat-like client in Cocoa. Nov. 15, 2002

Incorporating Rendezvous into Your Cocoa Applications, Part 1
ZeroConf networking provides solutions to addressing, naming, and service discovery that conspire to make IP networking as easy to use as AppleTalk. In part 1 in this series, Mike Beam explains how Rendezvous works and shows you its hooks into Cocoa. Nov. 8, 2002

Plug It In, Plug It In
Learn how to implement a plug-in architecture for ImageApp using Objective-C. Oct. 15, 2002

A Look Inside Address Book
This week Mike Beam takes a break from exploring graphics in Cocoa and takes a look at the AddressBook framework in Jaguar. There's a wealth of functionality for programmers who want to tap this data for their applications. Aug. 27, 2002

Bitmap Image Filters
This column reenters the realm of Cocoa graphics with a look at how to work with bitmap images on a pixel basis. Cocoa represents bitmap images using the NSImageRep subclass called NSBitmapImageRep. This subclass can work with data formats for many file types: TIFF, GIF, JPEG, PNG, BMP, and even raw, untagged data. Aug. 6, 2002

Adding Spit and Polish to Your Cocoa App
A look at two of NSApplication's delegate methods, plus a discussion about how to control the document window's title to display arbitrary information. And finally, how to endow ImageApp with a customized "about" panel. Jun. 14, 2002

All About the Little Green Glob
Polish your Cocoa applications by implementing intelligent "zoom" buttons at the top of the windows. Mike Beam shows you how. May. 17, 2002

Working With Bitmap Images; Document-Based Application Redux
Roll up your sleeves for this comprehensive tutorial that shows you an elegant way to build an image viewer from scratch in Cocoa. In subsequent columns, Mike Beam will add functionality to this app to make it an image editor. Apr. 19, 2002

Creating Toolbars for Mac OS X
Mac OS X toolbars are a great addition to Apple's GUI. Mike Beam takes you on an in-depth journey into their realm and explains how they work and how to create your own. Mar. 15, 2002

Cocoa Diversions; More on Views
This week Mike Beam looks at two Aqua enhancements—-one seemingly frivolous and the other not. What are they? Animated window resizing and drawers.  Feb. 15, 2002

Movies and Menus
A look at how to incorporate QuickTime media into Cocoa applications, plus a few words about menus, including dock menus. Jan. 25, 2002

Animating Graphics in Cocoa, Part 1
In his latest column, Mike Beam shows you how to put your Cocoa graphics in motion and introduces you to several new classes, including NSAffineTransform, NSTimer, and NSThread, as well as a new method of an old class, NSBezierPath. Jan. 4, 2002

Building a Scratch Pad with Cocoa
As Mike Beam continues his journey into the world of Cocoa graphics, he takes a look at how NSView objects can respond to mouse and keyboard events, which is useful for letting users interact with objects onscreen.  Nov. 30, 2001

Introduction to Cocoa Graphics, Part 2
In his previous column, Mike Beam explained the tools for drawing simple objects in Cocoa. This week, he explores more complicated shapes using Bezier curves, and shares some hands-on examples for you to experiment with. Nov. 6, 2001

Introduction to Cocoa Graphics
You can draw 2D shapes and even create animations directly in Cocoa. Mike Beam shows you how to implement NSRect, NSSize, and NSPoint in his latest column. Oct. 19, 2001

Working with Sheets in Cocoa
A feature of Mac OS X is a new way to handle dialog boxes, called sheets. This is a special kind of window that is actually attached to another window. This article explores two different ways to implement sheets in Cocoa. Oct. 5, 2001

Adding a Preferences Window to Your Application
Up to this point, this column's Cocoa projects have been single window applications. This week we'll delve into the multi-window world by adding a Preferences window, which is a staple of any application. Sep. 17, 2001

Mac OS X's Preferences System (and More!)
After tying up a few loose ends from the previous column on "Writing an Address Book Application" in Cocoa, this article will explore a couple ways to save the data for the address book program between launches, and then examine memory management issues and Mac OS X's preferences system. Aug. 24, 2001

Working with Tables: Writing an Address Book Application
Database tables are used to organize and display information. Mike Beam discusses how to use tables in Cocoa by showing you how to build an address book application. Aug. 10, 2001

Memory Management in Objective-C
The goal of memory management is to keep your application running like a well-oiled machine. Mike Beam discusses how to reduce memory leaks and keep your application from becoming a sluggish mess. Jul. 27, 2001

Strings in Cocoa, Part 2
A detailed look at NSString's path manipulation tools, and NSString's subclass, NSMutableString, which allows us to create strings with content that can be edited after their creation -- something not possible with NSString alone. Part 2 of a two-part series on strings in Cocoa. Jul. 13, 2001

Strings in Cocoa: Part I
Mike Beam takes a look at the two classes that make up the majority of Cocoa's string-handling ability -- NSString and NSMutableString -- and includes a peek at various ways to create strings.  Jun. 29, 2001

Creating a Color Meter Using Cocoa
Here's how to create a simple Cocoa app that allows you to explore interfaces and obtain information from user controls. The color meter consists of four sliders, four text fields, and one color well. Jun. 15, 2001

Giving the Simple Text Editor 'Legs'
This week, in part two of a two-part series, Mike Beam shows you how to complete your text editor project in Cocoa. Jun. 1, 2001

Build Your First Cocoa App
Now the fun begins. This week, Mike Beam shows you how to build your first Cocoa application -- and it's not just a "Hello, World" screen -- it's a real text editor. May. 18, 2001

The Objective-C Language
In this third installment of Programming With Cocoa, Mike Beam explains how to send messages to objects, as well as other basics of Objective-C authoring. May. 4, 2001

Components of Object-Oriented Programming
Mike Beam describes the OOP components used in Mac OS X's Cocoa programming environment -- including classes, message passing, inheritance, encapsulation, and polymorphism. Apr. 20, 2001

Digging Deeper into Mac OS X
Cocoa is the native Mac OS X developer environment. The tools are solid, and with them you can begin writing OS X applications. This is the introduction to O'Reilly's Cocoa column that will run regularly on the Mac DevCenter. Apr. 6, 2001