The NSButton class is a subclass of NSControl that intercepts mouse-down events and sends an action message to a target object when it’s clicked or pressed.
Questions tagged [nsbutton]
535 questions
10
votes
1 answer
how to get state of radio button and whether it is selected?
I have a group of radio buttons (matrix) and it has 4 choices. How can I find out what the selection is (programmatically) and get the BOOL of it?

ProSay
- 213
- 2
- 7
10
votes
6 answers
NSButton - set text color in disabled mode
For some reason, when my button is disabled, the text color turns white.
I want it to stay black - how can i do that?

Erik Sapir
- 23,209
- 28
- 81
- 141
10
votes
0 answers
How to NOT highlight the NSButton's template image when clicked?
I have NSButtons in each row of a NSTableView.
The buttons images are set in IB and are black icons with alpha channel:
The windows are set to dark mode with:
window?.appearance = NSAppearance(named: NSAppearanceNameVibrantDark)
And to normal…

Eric Aya
- 69,473
- 35
- 181
- 253
10
votes
4 answers
How to show a keyboard via press a NSButton?
I only know few ways to show a keyboard on iOS
touch textfield,search bar,textview.....
Is it can via touch a button to show keyboard ???
I wish I can use this way to set a button tittle if the button is no tittle or can rename it.
Thank you guys~

Webber Lai
- 2,014
- 5
- 35
- 66
10
votes
3 answers
NSButton RadioGroup (NSMatrix Alternative)
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 -…

Adrian Sluyters
- 2,186
- 1
- 16
- 21
9
votes
4 answers
NSButtonCell vs NSButton
I've been reading through the Apple documentation about NSButtons and cells and I really can't seem to understand the distinction between the two. Adding to this complexity, it looks like both of them have a large overlap of methods like setTitle:…

Tejaswi Yerukalapudi
- 8,987
- 12
- 60
- 101
9
votes
3 answers
How do I stop my NSbutton from being selected when the app starts by default?
I created a button, and a have a little problem: When the my app launches, the button is selected. How do I disable this selection?
Example:

Alexander
- 93
- 4
9
votes
2 answers
How can I vertically align my status bar item text?
Left one on the picture is the date and time from Apple and one is my application one. As you may see the text of my application appears lower than the Apple one. Which doesn't look pretty. How can this be resolved?
self.statusBarItem.image …

Mark
- 16,906
- 20
- 84
- 117
9
votes
2 answers
How do I check the state of a checkbox for macOS applications using Swift
The task seemed relatively simple, I wanted an if statement to determine if a check box is checked or not apparently check boxes but am at a loss
I've tried
if checkbox.state == everythign i can think of but it always errors either…

Jason M
- 351
- 2
- 5
9
votes
3 answers
Adding a control/button bar to the bottom of an NSOutlineView configured as a source list
I am trying to add a button bar to the bottom of my NSOutlineView-based source list, as seen in many Mac applications (both Apple and third-party), as seen in these screenshots:
To describe it textually, the control bar shares the source list's…

John Wells
- 1,139
- 1
- 10
- 27
9
votes
4 answers
How find out if I'm an NSButton with buttonType NSSwitchButton?
I'm subclassing NSButtonCell to customize the drawing (customizable theme). I'd like to customize the way checkboxes and radio buttons are drawn.
Does anyone know how to detect whether a button is a checkbox or radio button?
There is only…

uliwitness
- 8,532
- 36
- 58
8
votes
4 answers
NSButton white background when clicked
When creating Cocoa bevel button with custom image and alternate image I'm having a strange behavior. In the pressed state the button background becomes white.
I'm adding the button as subview of a transparent window (HUD window).
I'm trying every…

loretoparisi
- 15,724
- 11
- 102
- 146
8
votes
1 answer
NSButton + & - Button
In my application, i need to add + & - button to add and delete the row from a table,
I tried to find out any default image/ button but didn't get , Proper images for + & - button,
Do i need to arrange these buttons image by my own or its…

Amitg2k12
- 3,765
- 10
- 48
- 97
8
votes
4 answers
Lost in NSButton types and alternate images
I’d like to have an NSButton with an image and an alternate image. The alternate image should be displayed while the button is being pressed and I’d also like to display the alternate image from code, calling something like [button setSelected:YES].…

zoul
- 102,279
- 44
- 260
- 354
8
votes
3 answers
NSButton text insets with autolayout constraints
I am on OSX (not iOS), Xcode 8.2, Objective-C
I have two buttons with constraints. Both buttons got centered titles and both have the same width (via constraints). No when it comes to another language the buttons grows wider to fit the longer text.…

Pat_Morita
- 3,355
- 3
- 25
- 36