Skip to content

memega/NOSwitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOSwitch

A subclass of NSButton which looks similar to the UISwitch control in iOS7

alt text

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 set allowsMixedState to YES will 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.

About

An OSX implementation of UISwitch in iOS7

Resources

License

Stars

Watchers

Forks

Packages

No packages published