Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Using Checkboxes

A checkbox displays the setting of something in your application. Another name for a checkbox is switch button. A checkbox is identified square with a line of text. If the button’s off, the box is empty. If the button is on, the box has a checkmark in it. If the button is mixed-state, the box has a dash in it.

Contents:

Standard Checkboxes
Icon Checkboxes


Standard Checkboxes

It’s easiest to create a checkbox in Interface Builder. You can also create one programmatically by creating an instance of NSButton with a type of NSSwitchButton.

Unlike a group of radio buttons, more than one item can be on in a group of checkboxes. This group of buttons displays that all of the selected characters are bold, none are italic, and some are underlined:


Various switch button settings

Icon Checkboxes

You can also have a checkbox that’s an icon button; that is, one that’s primarily identified by its icon and has little or no text. If the button’s off, it appears to be sticking out. If the button’s on, it appears to be pressed in. (An icon button cannot display the mixed state.)

You can create an icon checkbox in either Interface Builder or programmatically. If you use Interface Builder, start with a push button. If you create it programmatically, create an instance of NSButton. Then change it by setting its type to NSPushOnPushOffButton, its image position to NSImageOnly, its bezel type to a square bezel type. Then set the image to what you want.



< Previous PageNext Page > Hide TOC


Last updated: 2007-12-11




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice