I need to create a checkbox programmatically in Cocoa and when I try and make a button with buttonType
set to NSSwitchButton
it displays the title, but does not show the button as a checkbox. I think I am missing something but I can't find any resources about making things like checkboxes without using the Xcode GUI.
Macos – Creating a checkbox programmatically using Cocoa
checkboxcocoamacos
Related Topic
- Objective-c – Creating Cocoa PopUpMenus programmatically and Getting code form a GUI item built with the interface builder
- Javascript – Check if checkbox is checked with jQuery
- Html – How to style a checkbox using CSS
- Html – Using the HTML5 “required” attribute for a group of checkboxes
- Html – How to create a checkbox with a clickable label
- Javascript – Check/Uncheck checkbox with JavaScript
- JQuery set checkbox checked
- Cocoa Autolayout: content hugging vs content compression resistance priority
Best Answer
The question is a little old so you've probably already figured it out, but I found it while searching for this exact thing. Alex danced around the solution without actually providing it. So here, for Google and all mankind: how to programmatically create a checkbox in Cocoa.