CocoaDev

Edit AllPages

I’ve found that you sometimes need static content in an array controller, which doesn’t seem possible without subclassing NSArrayController.

An example of this is the “All Artists” entry at the top of the artist browse table in iTunes.

To achieve this, define an NSArrayController subclass, e.g. JHStaticContentArrayController:

@interface JHStaticContentArrayController : NSArrayController { NSArray *staticContent; }

@end

The setStaticContent: method obviously takes in an array of objects that you want added to the TOP (at least in this example) of the resulting content array. The magic happens in arrangeObjects:

Some caveats:

– JeremyHiggs