Available in Github

Flat style UISwitch control for iOS 5+.
Supports customizable control tint color, sizes, and shapes.

Requires iOS 5+ and ARC.


Add NKColorSwitch folder to your project and import "NKColorSwitch.h".


1) Create NKColorSwitch and add to view programmatically or using nib

// Create NKColorSwitch and specify desired rect
NKColorSwitch *nkColorSwitch = [[NKColorSwitch alloc] initWithFrame:CGRectMake(20, 54, 60, 30)];

// Specify target to receive value change
[nkColorSwitch addTarget:self action:@selector(switchPressed:) forControlEvents:UIControlEventValueChanged];

[self.view addSubview:nkColorSwitch];

2) Change control appearance

// Set ON background color
[nkColorSwitch setOnTintColor:[UIColor greenColor]];

// Set OFF background color
[nkColorSwitch setTintColor:[UIColor redColor]];

// Set Thumb color
[nkColorSwitch setThumbTintColor:[UIColor whiteColor]];

// Set ON background border color
[nkColorSwitch setOnTintBorderColor:[UIColor lightGrayColor]];

// Set OFF background border color
[nkColorSwitch setTintBorderColor:[UIColor lightGrayColor]];

3) Change shape

// Change shape to oval
[nkColorSwitch setShape:kNKColorSwitchShapeOval];

// Change shape to rectangle
[nkColorSwitch setShape:kNKColorSwitchShapeRectangle];

// Change shape to rectangle no round corner
[nkColorSwitch setShape:kNKColorSwitchShapeRectangleNoCorner];