PXNavigationBar
PXNavigationBar is a navigation bar control for Mac OS X >= 10.5
What is this
PXNavigationBar is modelled on the iTunes navigation bar (as shown below) for navigating through hierarchical content.
As can be seen there are 3 parts to the navigation bar:
- the title in the centre
- the back button on the left
- the navigation buttons on the right
How the control works
PXNavigationBar works by splitting each level in the navigation hierarchy into levels. Each level is represented by an instance of PXNavigationLevel, which encapsulates items each represented by a PXNavigationItem instance.
Each level has a currently selected navigation item (which by default is the first item). The left and right navigation buttons (displayed on the right of the navigation bar) cycle left and right respectively through the items in the currently displayed level.
The currently selected item in the currently selected level is the item whose title is displayed in the centre of the navigation bar.
Levels can be pushed onto and popped from the navigation bar’s stack of levels, and pressing the back button (displayed on the left of the navigation bar) pops the current level off the stack.
Using the code
1. Download the Source
Download the source from Github and copy the following files into your project:
PXNavigationBar.handPXNavigationBar.mPXNavigationLevel.handPXNavigationLevel.mPXNavigationItem.handPXNavigationItem.mPXBackButtonCell.handPXBackButtonCell.mPXNavigationButtonCell.handPXNavigationButtonCell.m- The images in the
Resources/imagesdirectory
2. Add the control to your interface
To create the control in Interface Builder, drag a custom NSView object from the Library to your window/view. In the Identity Inspector change the class name from NSView to PXNavigationBar. The bar can take any width but ensure that the height is 28 pixels.
3. Working with PXNavigationBar
Make sure to #import "PXNavigationBar.h" for files that require it (the other header files are imported from this main header), and ensure that the object which is the delegate for the navigation bar conforms to the PXNavigationBarDelegate protocol.

