views:

3023

answers:

3

I think the title pretty much says it all... I'm looking to implement an interface similar to the standard OS X sidebar used in all the above mentioned programs, and I'm wondering if anybody has any thoughts as to the easiest way to do it, namely about what view to use for the left hand selection pane. Really I don't think I even need the hierarchical component as seen in the apple apps, I just need a good looking flat list of choices which determine what's shown in the right hand pane.

The obvious start is a vertical split layout view, but beyond that I'm not entirely sure where to go. A collection view with only one column or something like that?

+2  A: 

Perhaps the example available here would help.

SoloBold
Thanks, that helps a lot. For the curious but lazy the example above uses a two column tableview (one for icons one for text) in the left pane with the headers disabled.
Lawrence Johnston
+7  A: 

I've done a few applications that use a similar setup.

I generally use an NSSplitView, with a single column NSTableView in the left pane. Don't forget to disable the headers, and make it display as a "Source View" style.

If you want the disclosure triangles, then you'll want to use NSOutlineView instead of NSTableView, but at least for the first go, I'd stick to a simple NSTableView.

A pattern I also use is to make the NSTableView slightly shorter than the NSSplitView, and have buttons at the bottom (add, delete, etc). I've usually built the program around Core Data, so it's easy to hook up these to methods to create/delete objects, and then bind the NSTableView to the array of objects.

Matthew Schinckel
+9  A: 

Direct support for this sort of thing was added in Leopard. It's called a 'source list'.

Please see the AppKit release notes. Search for NSTableViewSelectionHighlightStyleSourceList in the document.

Or, drag out a table view and select Highlight: Source List in Interface Builder.

Ken
You'll also want to implement the outlineView:isGroupItem: delegate method to return YES for the rows that have the all-caps header titles.
Brian Webster