NOSwitch
NOSwitch copied to clipboard
An OSX implementation of UISwitch in iOS7
NOSwitch
A subclass of NSButton which looks similar to the UISwitch control in iOS7

Usage
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];
Customization
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];
Limitations
-
Does not support
NSMixedState. An attempt to setallowsMixedStatetoYESwill have no effect. -
This control does not display neither text value nor custom image.
License
This project is licensed under the terms of the MIT license.