FAQ Database Discussion Community


NSButton binding to NSCollectionViewItem: representedObject?

objective-c,swift,binding,nsbutton,nscollectionviewitem
When I pre-added a button to the NSCollectionViewItem's view, I can bind its action in the inspector: Which works without problem. Now I'd like to create that button programmatically within the view's mouseDown:, what should I assign to the bind: option for the same result as the "Bind to: Collection...

NSButton(Cell) setFont

cocoa,custom-controls,nsbutton,nsbuttoncell
It seems that NSButtonCell's setFont method is not available anymore from 10.9. Is there any way (or category) to (re)implement it? I don't know why Apple forces it's own styles on buttons. I am trying for 2 days to style my own custom button (I also needed a category to...

Cocoa osx NSButton show text when mouse over

osx,cocoa,text,mouseover,nsbutton
In my application for Mac I want to show some info text when the users moves the mouse pointer over a button. Something like this: How can I achieve this correctly? Thanks in advance....

Drawing artifacts when drawing a NSString in a NSButton

cocoa,nsstring,drawrect,nsimage,nsbutton
I am using drawRect to draw a NSString inside a custom view, which is a subview of NSButton. The drawRect of the NSButton is also drawing an NSImage, which appears to the be the problem. If I remove the drawRect code for the NSImage, it no longer happens (but then...

Change background image of a button programatically cocoa obj-c

xcode,image,cocoa,nsbutton,nscollectionview
I am creating NSCollection View (in Cocoa) with many identical buttons in size and appearance, except for their icons (or you could probably call them Background Images). In my xib file I have the button binded to the Collection View (Model key path: representedObject.foto) and the Array Controller has class...

NSButton RadioGroup (NSMatrix Alternative)

swift,nsbutton
I've tried a few times to set up several similar buttons, all connected to the same IBActions, and still can't seem to replicate the RadioButton Behaviour. At the moment, I have 5 Buttons, all children of one NSView.. NSView - ButtonOne - NSButton (Square Button) - ButtonTwo - NSButton (Square...

How can I keep one NSButton as pressed after click on it?

xcode,cocoa,interface-builder,appkit,nsbutton
I have one NSButton and I want when I pressed it to stay as pressed. ...

How to make flat NSButton?

cocoa,nsbutton,nsbuttoncell
How can I make a flat NSButton just like in this picture? I think this picture from Mac OS X >= 10.9. I have Mac OS X 10.8.5....