A subclass of NSButton which looks similar to the UISwitch control in iOS7
Place a Check Box
in your nib and select it. Open Utilities→Identity Inspector (⌥⌘3
) and assign NOSwitchButton
class.
Or create it in code:
#import "NOSwitchButton.h"
NOSwitchButton *button = [[NOSwitchButton alloc] initWithFrame:NSMakeRect(0,0,60,36)];
[self.window.contentView addSubview:button];
By default, NOSwitchButton
uses the same shade of green as UISwitch in iOS7. You can change it with tintColor
property:
button.tintColor = [NSColor colorWithCalibratedHue:0.05 saturation:0.86 brightness:0.99 alpha:1];
-
Does not support
NSMixedState
. An attempt to setallowsMixedState
toYES
will have no effect. -
This control does not display neither text value nor custom image.
This project is licensed under the terms of the MIT license.