I've tried to add NSPopupButton + CustomView, but it's not what I wanted. I would like to mimic "Tasks" on Xcode's toolbar.
You want to change the 'Type' of the NSPopUpButton to "Pull Down."
Here's a great video demonstration on precisely what you're looking for: http://www.youtube.com/watch?v=Qr6EX-JIZZU.