Latest 0.1.0
Homepage https://github.com/memega/NOSwitch
License MIT
Platforms osx , requires ARC
Authors

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.

Latest podspec

{
    "name": "NOSwitch",
    "version": "0.1.0",
    "summary": "An OSX implementation of UISwitch in iOS7",
    "description": "  A subclass of NSButton (and NSButtonCell) which renders similar to UISwitch control in iOS7.n",
    "homepage": "https://github.com/memega/NOSwitch",
    "screenshots": "http://i.imgur.com/18RooVw.jpg",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Yuriy Panfyorov": "[email protected]"
    },
    "platforms": {
        "osx": null
    },
    "source": {
        "git": "https://github.com/memega/NOSwitch.git",
        "tag": "0.1.0"
    },
    "source_files": [
        "NOSwitch/NOSwitchButton.*",
        "NOSwitch/NOSwitchButtonCell.*"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This