Skip to content

rsimenok/RSSwitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RSSwitch

Custom Switch for iOS, based on UIControl class.

Primitive and easy customizable switch for iOS.

A preview of this control

RSSwitch *myswitch = [[RSSwitch alloc] initWithFrame:CGRectMake(30, 30, 100, 50)];
[myswitch setOnColor:[UIColor greenColor]];
[myswitch setOffColor:[UIColor whiteColor]];

// you can easily change border radius/color/width by accessing switch view layer 
[myswitch setBorderColor:[UIColor lightGrayColor]];
myswitch.handleView.backgroundColor = [UIColor whiteColor];
myswitch.handleView.layer.borderColor = [UIColor lightGrayColor].CGColor;

// switch notificate you for events UIControlEventTouchUpInside and UIControlEventTouchUpOutnside
[myswitch addTarget:self action:@selector(switchSwitched:) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:myswitch];
-(void)switchSwitched:(RSSwitch *)sender {
    NSLog(@"state: %i", sender.isOn);
}

License

RSSwitch is licensed under the terms of the MIT license. Please see the LICENSE file for full details.

About

Custom Switch for iOS, based on UIControl class.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published