项目介绍:
一个iOS控制开关
An iOS switch control implemented in Swift with full Interface Builder support.
DEMO 直接下载:
To run the demo project:
pod try RoundedSwitch
集成代码:
[Objective-C] 查看源文件 复制代码
import Switch ... let mySwitch = Switch() mySwitch.leftText = "Windows" mySwitch.rightText = "Mac" mySwitch.rightSelected = true mySwitch.tintColor = UIColor.purpleColor() mySwitch.disabledColor = mySwitch.tintColor.colorWithAlphaComponent(0.2) mySwitch.sizeToFit() mySwitch.addTarget(self, action: #selector(ViewController.switchDidChangeValue(_:)), forControlEvents: .ValueChanged)