Wed, 10 Sep 2008 14:42:56 GMT

Outline view, tree controller and itemForPersistentObject

This is the scenario: your user interface comprises an outline view and a hierarchical data model. You want the outline view to display the hierarchy and remember the expansion state automatically in preferences. Hence when the user re-runs the application, the items that were expanded are still expanded, and vice versa: what was collapsed remains so. Outline view, tree controller, hierarchical model, bindings. That’s the recipe.

According to some, storing expansion state of an outline view when used with a tree controller is not just difficult: it’s impossible! But is it? No, is the simple answer. It’s actually quite easy. In this article I introduce a new helper class called RROutlineViewExpandedItemsAutosaver! Original aren’t I? It does not involve sub-classing or access to private methods. The solution presented uses only documented interfaces and only requires a small stateless class instance for handling all outline view auto-saving technicalities. It does assume Core Data use for modelling. But you can easily adapt the technique for other data-model implementations.


Fri, 29 Aug 2008 08:37:41 GMT

Organising view controllers

Understanding how individual view controllers work is one thing. Organising them is another. Applications typically deal with multiple view controllers. Views can change dynamically. Hence view controllers need dynamic capabilities.

This article presents an idea for organising view controllers within an application. Design goals include: flexibility, simplicity, convention over configuration.


Tue, 26 Aug 2008 19:30:00 GMT

View controllers

NSViewController. It’s an enigmatic class.

Exactly what is it? When should it be used? Apple’s documentation does not paint a clear picture. What is there to glean from its interface, implementation as well as others’ work on this subject?