The Axamblis Blog » Interface Builder
Developing Software is an Art.
Axamblis Developer Podcast — Friday, September 18, 2009 19:48

Episode 1: SplitView-aligned Toolbar

 

» Download the episode

This is the very first episode of the Axamblis Developer Podcast. We’re looking at how to create a custom NSToolbar which aligns a subset of its items along the right side of a split view divider in the same window. This behaviour which makes the items feel like they stick to the divider can also be found in other apps like Apple Mail or Espresso (my favourite web editor, by the way).

SplitView-aligned Toolbar

In order to get the desired bevaviour we make use of some undocumented API in the NSToolbar class, and we use method swizzling to inject some custom code into the NSToolbarFlexibleSpaceItem class.

The category used for swizzling methods:

The project file (Xcode 3.1 and higher) as well as the .h and .m files:

Enjoy the show and drop me a line if you have any comments or questions or other feedback!