Setting a Button’s Image

A button can have two images associated with it: normal and alternate. If the button type is NSMomentaryPushInButton, NSPushOnPushOffButton, NSMomentaryLightButton, or NSOnOffButton, only the normal image is ever displayed. If the button type is NSMomentaryChangeButton or NSToggleButton, the normal image is displayed when the button’s state is off (NSOffState) and the alternate image is displayed when the button’s state is on or mixed (NSOnState. or NSMixedState). If you want a button to display different image for all three states, you must subclass NSButton. (Although switch and radio buttons can display different images for all three states, there is no public interface for this feature.)

To set the normal image, use setImage:. To set the alternate image, use setAlternateImage:.

To set the position for a button’s image, use setImagePosition:, with one of the following values below. The default is NSNoImage