Archive for June, 2005

Cocoa custom popup/pulldown buttons

Wednesday, June 8th, 2005

If you don’t like the standard popup/pulldown button and would rather have a cool custom button for your popup and pulldown menus, like this:

Then here’s a neat little trick for doing just that. In Interface Builder, first drag a standard NSPopupButton from the palette, and specify it as ‘hidden’. After you’ve added the menu items that you want, drag over an NSButton and add your custom icon to it. Then control-click drag from the NSButton to the NSPopupButton and connect it to the ‘performClick’ target/action. In Interface Builder your buttons will look like the ones below:

And that’s all there is to it.