Raphael Caixeta
Raphael Caixeta

Reputation: 7846

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

alt text

Here's the button I'm trying to get (right hand side)

alt text

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!

Upvotes: 1

Views: 2301

Answers (2)

Regexident
Regexident

Reputation: 29562

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/

Upvotes: 7

Piotr Byzia
Piotr Byzia

Reputation: 3423

It's Shows Toolbar Button in Window's Attributes, in Interface Builder.

Upvotes: 0

Related Questions