Wooji Juice

Articles for February 2008

Cocoa: Where to start?

So, you've read the previous four cocoa articles and you have a bunch of answers for Trivial Pursuit: Cocoa Edition. But actually getting going with an application can be daunting.

In part this was, for me, because Cocoa idioms are quite different from those of frameworks I've used before. Cocoa has quite a lot of time-saving "magic", but it's not always obvious what and where that's going on; "where I come from," the infrastructure is more overt (but less useful). In most of those, the first order of the day was to create a new subclass of Application and start filling in the blanks.

Read more...

Cocoa: Custom Classes in Nibs

We looked at how Nib files contain arbitrary object instances, and how Interface Builder lets you create them by just dragging one off of a palette. Cocoa lets you do a decent amount with the default controls, but what about getting your own code in there?

Well, you can change the class of an object in Interface Builder. What this does depends on the object in question. For File's Owner, it doesn't affect the object passed in at all — because at design-time File's Owner is just a placeholder, and at run-time it's already been created before the Nib even starts loading. Changing the class just informs IB so that at design-time, it can represent that class more accurately.

Read more...