Aaron Brethorst

Round peg in a square hole, rabid generalist.

Subclassing NSCell - the Easy Way

| Comments

Mike Ash, a developer at Rogue Amoeba, published an article a while back about subclassing the Cocoa class NSCell in a way that doesn’t make you want to stab your eyeballs with a pen. Having suffered through a lot of this with iRooster, I recognize and appreciate the value present in this article, and I hope it helps save an extra eyeball or two.

http://www.mikeash.com/blog/pivot/entry.php?id=17: Anyone who’s done enough Cocoa has eventually run into the nightmare that is subclassing an NSCell. While it looks simple enough, actually getting an Interface Builder-generated control to use your NSCell subclass is effectively impossible. You either have to use CustomViews in IB, write an IBPalette, or do a whole lot of tedious and error-prone manual copying of attributes to get everything from the IB-provided cell into your own.

Tonight I’m going to show you a simple class you can add to your project which will make everything Just Work.