How to get this button on NSWindow
I'm making a new OSX app and I'm trying to copy the flow that tons of apps use. I just need to know how to add a button on the right hand side of the application's title.
Here's what I currently have
Here's the button I'm trying to get (ri开发者_开发知识库ght hand side)
I don't know what it's called, but when I try to drag a sample push button, Interface Builder just ignores it.
Thanks for any help in advance!
It's the button that shows up whenever you add a toolbar to your window.
Clicking it toggles the toolbar's visibility. And this should be the only thing ever to happen when clicking on one of those buttons. It's what the user expects.
You wouldn't want your "close window" button to do anything other than closing either.
Now to technically answer your question of how to add buttons to the window's top bar:
[[[window contentView] superview] addSubView:myButton]; //
There is now way of doing this via Interface Builder.
And here you have a detailed tutorial:
http://13bold.com/tutorials/accessory-view/
It's Shows Toolbar Button in Window's Attributes, in Interface Builder.
精彩评论