Edit AllPages

This is a set of source code that concentrates on NSToolbar, and NSToolbarItem

As people have been requesting it, here is some stripped source of a complete NSToolbar implementation from one of my apps. It works, it just may not be the best method to do it. It’s my interpretation of the documentation basically, and yes, I use awakeFromNib usually (although I would recommend creating the toolbar when the window has finished loading). – MatPeterson

@interface ToolbarClass : NSObject { IBOutlet id window; // Window to link toolbar to NSToolbarItem *import; // Item that we are adding }

@implementation ToolbarClass


Or you could try the more traditional delegate category on your window controller, and implement the setupToolbar method in the latter.

#import “MyToolbarDelegateCategory.h”

@implementation MyWindowController ( MyToolbarDelegateCategory )


see also GenericToolbar