Articles for January 2008
Cocoa Nibs
NIB files (or just Nibs) are, loosely speaking, Interface Builder's save format. Having used "GUI builder" tools before, it was easy to think of them as descriptions of window designs, but they're actually slightly different.
Nibs are just arbitrary collections of Objective-C objects — UI widgets or otherwise — serialised to disk. You can create any object instances you want in a Nib file and they'll be unserialised when the Nib loads. As well as creating them, you can configure many of their member variables, and set up links between them so they can find each other at runtime (see Actions and Outlets, explained previously).
Cocoa Actions
Actions are a common way of sending events around in Cocoa. They're very straightforward; they deal with the simplest kind of event, such as the user clicking on a button or menu item.
Actions consist of two bits of information bundled together: A selector, and a pointer to an object (the "target"). When the event occurs, a message with that selector is sent to the target object, passing the event's sender as the sole parameter.
Cocoa & Selectors
Happy New Year! One of the things I want to do this year is post more short, regular content. A friend of mine is learning Mac programming, so to help out, I'm planning to write short snippets that explain bits of Cocoa (The Mac OS X programming framework) that I didn't "get" the first time round. Often, the concepts aren't that difficult, and often I already knew them by other names, but didn't make the connection. I just didn't really find the official explanations as helpful as they could be.